Road to DevOps Pro — Day 4 (Oct-16th 2022): Linux Commands
In this class, we will learn various Linux commands that we will use daily as DevOps engineers. Some Linux commands are listed below in their respective categories
User Information Commands
- who: It will provide
— Login name of the user
— Date and time of login
— remote hostname of the user
who
2. whoami: it displays the current logged-in username
whoami
3. id: it displays the user identification i.e real and effective group id
id
4. groups: This command is used to display the groups to which the user belongs to
groups
5. ways to become a sudo user in Linux OS
sudo -i
sudo -s
sudo su -
su -root
su -
6. users : shows the username of all currently logged in user
users
7. clear: clear the terminal screen
clear
lastlog: The lastlog command is used to find the details of a recent login of all users
lastlog
File and Directory Commands
/ is your root Directory
~ is your home Directory
To understand the meaning of the above two lines, we need to understand the directory structure of Linux
cd / will bring you to the root folder and cd ~ bring you to the respective user folder.
example for jason in above case it will be like /home/jason or /home/prabhat in my case
- pwd : It prints the present working directory
2. ls: list directories inside the path
3. mkdir:
The mkdir command allows users to create a directory or folder. The command is mkdir folder_name
4. rmdir:
The rmdir command allows user to remove directory
----> -p that refers for the parent (which means remove directory along with it's ancestors)
----> -v verbose will give output for the processed directory
Installing Packages
- Install the package with help of the yum command which will look like
yum install package_name
2. Display brief detail about a package
yum info package_name
3. This is going to remove the package
yum remove package_name
4. Installing a package from a local file
./filename
Disk Usage Commands
- To find out the disk usage summary
du pathofdirectory
2. This will bring up your information in a human-readable format
du -h pathofdirectory
Provides disk usage details in MB and kb.
3. To Find the total Disk usage
du -sh nameofdirectory
System & hardware information Commands
- Get all system information
uname -a
2. To know the Kernel name
uname -s
3. To Print Kernel release version
uname -r
4. Print Architecture
uname -m
5. Print the operating System
uname -o
We are done for today with our starter commands of Linux. In next few class we are going to jump deep in Linux World.
Till Then Adios Amigos