Learn Linux Shell Utilites

Posted by Moussan



in this chapter we will cover some important Shell Utilites commands that will help you to deal with linux operating system easily



Usage : display list of users who logged in with you to the system right now


Usage : display which user you used to log-in to the system


Usage : display detailed information about all users existing in the system


Usage : display how long the system works (Booting Time)


Usage : display successfull booting times of the system and also display if these users are disconnected or still logged-in


Usage : display failed attempts of system booting


Usage : returns type of your operating system (linux)


Usage : returns some information about your operating system like

server name , kernel version , 32 bit or 64 bit


Usage : returns information about server name and some info about your operating system


Usage : Change server hostname of your operating system


Usage : returns time and date on server


Change (Date) :

timedatectl + set-time + {2019-12-9}

Change (Time) :

timedatectl + set-time + {5:30}

Change (time zone) :

timedatectl + set-timezone + Africa/Cairo


in this section we will cover how to compress any file in linux by command line

there are 3 main commands for this function :

tar / gzip / bzip2


1- Tar Command

To Compress Files :

tar + { -cvf } + {file.tar} + file1 file2

(file.tar) => refers to compressed file which will be generated from Compression of file1 and file2

( -cvf ) => it's option used with tar command for compression

To Display Content of Compressed Files:

tar + { -tvf } + dir.tar

Usage : display files in dir compressed folder without uncompress it

To uncompress Files :

tar + { -xvf } + dir.tar


2- Gzip Command

To Compress Files :

gzip + file1 file2

this command will replace these 2 files with new 2 compressed files file1.gz , file2.gz

To Uncompress Files :

gunzip + file.gz

this command will restore the original file and undo the compression


3- Bzip2 Command

To Compress Files :

bzip2 + file1 file2

output compressed files will be like file1.bz2 , file2.bz2

To Uncompress Files :

bunzip2 + file.bz2


1- Grep Command

Example :

grep -i + word + file

Usage : search about any word inside files


2- Find Command

Structure :

find + place + option + argument

Example :

find /var -name log

to search in files only:

find /var -name log -type f

to search in directories only:

find /var -name log -type d


1- set or env Command

Example : set | more

Usage : display all linux shell variables


2- echo + ${variable_name}

Usage : display value of specific shell variable


3- unset Command

Usage : remove any shell variable


4- variable_name = value

Example : x = 5

Usage : create new shell variable


Example :

Command1 ; Command2 ;

to execute multi commands at once we can add ( ; ) after each command