Road to DevOps Pro — Day 4 (Oct-16th 2022): Linux Commands

prabhat kumar jena
4 min readOct 29, 2022

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

  1. who: It will provide
    — Login name of the user
    — Date and time of login
    — remote hostname of the user
who
who command

2. whoami: it displays the current logged-in username

whoami
whoami command

3. id: it displays the user identification i.e real and effective group id

id
id command

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
users command

7. clear: clear the terminal screen

clear
clear command usage

lastlog: The lastlog command is used to find the details of a recent login of all users

lastlog
lastlog command

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

  1. pwd : It prints the present working directory
pwd command

2. ls: list directories inside the path

ls command

3. mkdir:

The mkdir command allows users to create a directory or folder. The command is mkdir folder_name

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

  1. 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 
yum install docker[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

  1. To find out the disk usage summary
du pathofdirectory
du folder_name

2. This will bring up your information in a human-readable format

du -h pathofdirectory
e

Provides disk usage details in MB and kb.

3. To Find the total Disk usage

du -sh nameofdirectory

System & hardware information Commands

  1. 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

--

--

prabhat kumar jena

A Senior Software Engineer with 5+ years of experience