100 Essential Linux Commands
Normal Linux user knows almost all the basic Linux day-to-day use commands to perform basic task such as installing any application, copying files from one directory to another, etc. But in this article I’m going to list 100 essential Linux commands which can be useful for every Linux user right from the noobs to the professional Linux developers and system administrators.So before wasting any time let’s get started with this huge list of essential Linux commands.
This command can be used to get the contents of the file as an output in the Terminal window. You just need to write the
cat command as shown sample screenshot and execute it.
As the name suggests this command can be used to create, view and concatenate files.
If the file is longer than the size of Terminal window then it will be not easy to read or view all the content of the file easily. But there is a tweak, you can use less with cat command. It will give user an ability to scroll forward and backward through the content of the files using PgUp and PgDn keys or Up and Down Arrow keys on the keyboard.
Finally to quit from the less you can just type in q.
Aptitude is highly powerful interface for Linux package management system.
First of all you need to install or update aptitude package in your system using following command.
Once the installation is complete you can type aptitude in Terminal and execute it, this will open up aptitude interface.
You can use this
aptitude built-in interface to update, install or remove any application package on Linux or its other distributions.
You can use
cal command in Terminal window to see the calendar, as you can see in the following screenshot I have executed command to view the calendar of the current month and you can notice it highlighted the date as well.
You can also view the calendar of particular year you want to see.
bc is another cool and useful command for Linux users as it allows you to enable command line calculator in Linux Terminal when you execude following command.
The Linux command
chage is an acronym for change age and it can be used to change the expiry information of the user’s password.
As you can see in the screenshot you can also force the user to change the password after certain period of time i.e. periodically. This is an excellent command for system administrators.
You can get all the information of your file system just by executing
df command in the Terminal window.
If you use
df –h it will display file system information in human readable format as you can notice in following screenshot.
When you execute this
help command in Terminal window, it will list all built-in commands you can use in shell.
pwd (Print Work Directory)
As the name Print Work Directory suggests, this command the path of the directory currently you’re working in. This command is very useful for all the Linux noobs and those who are new to Linux Terminal.
I think I don’t need to introduce to this command as this is one of the commonly used commands in Terminal by Linux users.
When you type and execute ls command in Terminal, it will show you all the contents of the particular directory i.e. both files as well as directories as you can see in above screenshot.
factor is a mathematical command for Linux terminal which will give you all the possible factors of the decimal number you enter in the shell.
uname is another useful Linux command to have as it displays Linux system information when executed in Terminal shell.
To view all system information type
uname -a in Terminal.
For information related to kernel release only just type in
And for operating system information type
uname -o in Terminal shell.
If you want to check if your system is connected to router or internet then PING (Packet INternet Groper) is the command for you. It uses ICMP protocol to connect to other devices.
There are several options to use with ping command, ping displays addresses as host name so if you want to view them in numbers then use
ping -n command.
Ping -I to specify the interval between transmissions as it is 1 second by default.
mkdir <file name> command can be used to create a new folder in any directory using Linux Terminal. You can see in the following screenshot that I have created VGPM folder using mkdir command in Terminal shell.
You can also use
rmdir <file name> command to remove any folder in the directory right from your Linux Terminal window.
You can compress any file from Terminal window using
gzip <file name> command but it will remove original file from the directory. If you wish to keep the original file then use
gzip -k <file name> instead as it will keep both original as well as new compressed file in the directory.
If you wish to know for what the particular Linux command can be used for then just execute the command
whatis <command name> in Terminal shell and it will show you short one line description of that particular Linux command.
This one is for system administrators who handle and manage various users on Linux system.
who command when executed in Terminal show the complete list of those users who are currently logged into Linux system.
free command can be used to check exactly what amount of storage is free and used in physical as well as swap memory in the system.
There are also some options to use with free command such as you can use
free -k to display the available and used in memory in kilobytes,
free -m to to view in megabytes,
free -g to view results in gigabytes and
free –tera to view the results in terabytes.
top is simple but useful command to monitor all the ongoing processes on the Linux system with the user name, priority level, unique process id and shared memory by each task.
This one is just for bit fun during the work and not a useful command. When executed a steam engine passes through Terminal window. You can try it for fun!
If you are unable to see it then use the following command to install it.
$ sudo apt install sl
banner is another fun command for Linux Terminal when executed with banner <your text> will display whatever text you type will be displayed in big banner format
sudo apt-get install banner
How about putting the Terminal window on fire? Just fire the command
aafire in the Terminal window and see the magic.
sudo apt-get install libaa-bin
echo command can be used to print any text you type with the command as you can see in the below screenshot.
<user name> will display all the information about any user on the system such as last login of the user, home directory of the user and full name of the user account.
If you want to know which groups the particular user is member of then execute
groups <user name> command in Terminal window. It will show entire list of the groups a user is member of.
This command will list the first 10 lines of the file you through with head command in the Terminal window. If you want to see particular number of lines then use -n (number) option like
head -n (any number) <file name> in Terminal shell.
Here man stands for user manual and as the name suggests
man <command name> will display the user manual for the particular command. It will display name of the command, ways in which command can be used and description of the command.
You can use
passwd command to change the password for self or any user, just through the command
passwd if you want to change password for youself and
passwd <user name> if you want to change password for particular user.
whoami command will help you to find out which user is logged into system or who you are logged in as.
When fired into Terminal shell,
history command will list all the commands used by you in serial numbered form. Using exclamation mark ! and serial number of the command will help you execute that particular command without need to writing whole command in the terminal.
w is the short and simple command which will help you view the list of currently logged in users.
If you want to switch user or want to create new session then fire this command in Terminal window and provide the details like login id and password
lscpu command will display all the CPU architecture information such as threads, sockets, cores and CPU count.
mv (move) command can be used to move one file or directory to another file or directory. It is very useful command especially when you’re working on system administration.
If you want to see the list of processes that are currently running for your session or for other users on the system then
ps command is for you as it shows processes with their process identification numbers and in detail as well when you use
ps -u command.
You can use this command to
kill the currently ongoing processes manually form the Terminal shell itself. You need unique PID i.e. process identification number to kill the process.
<file name> command will display last 10 lines of the file in the Terminal window as an output. There is an option to last specific number of lines as you want with the command
tail -n <number of lines> <file name> as shown in screenshot below.
cksum is a command to generate the checksum value for the file or stream of data thrown with command in Linux Terminal. You can also know whether the download is corrupted or not if you are facing problem in running it.
If you ever need to do byte-by-byte comparison of the two files then
cmp <file name 1> <file name 2> is the best Linux command for you.
env is a very useful shell command which can be used to display all the environment variable in the Linux Terminal window or running another task or program in custom environment without need to make any modifications in current session.
hostname command can be used to view the current host name and hostname <new name> can be used to change the current host name to new one.
You can use
hwclock or hwclock –set –date <DD/MM/YYYY> command to view hardware clock or set it to new date.
lshw command can be used to invoke detailed hardware information of the system on which Linux is running. It gives you every small detail about hardware
nano is Linux command-line text editor just similar to Pico editor which many of you might have used for programming and other purposes. It is quite useful text editor with lots of features.
rm <file name> command can be used to remove any file from the working directory. For better convenience you can use rm -i <file name> command as it will first ask for your confirmation before removing the file.
ifconfig is another useful Linux command which can be used to configure network interface on the system.
clear is simple command for Linux Terminal shell, when executed it will clear the Terminal window for fresh start.
su <username> command can be used to switch to another account right from the Linux Terminal window.
wget <file path> is very useful command to download any file from the internet and best part is download works in background so that you can continue working on your task.
yes “your text” command is used to display a text message entered with yes command repeatedly on Terminal window until you stop it using CTRL + c keyboard shortcut.
last command will display the list of last logged in users into the system as an output in Linux Terminal.
locate command is an reliable and arguably better alternative to find command to locate any file on the system.
If you ever need to monitor system input/output devices then
iostat command can be very useful for you as it displays all the stats of the CPU as well as I/O devices in Terminal window itself.
You can use
kmod list command to manage all the Linux Kernel modules as this command will display all the currently loaded modules on the system.
lsusb command will show information about all the USB buses connected to the hardware and external USB devices connected to them as you can see in screenshot below.
pstree command displays all the currently running processes in the tree format on Linux Terminal window.
If you need to run any command as a root user or root permissions then just add
sudo at the start of any command.
apt (Advanced Package Tool) is Linux command which helps user to interact with the packaging system
You can use
zip command to compress one or more files as you can see in the screenshot below. It is simple but useful command to compress any number of files in a go.
To extract files from compressed zip file use
unzip <file name> command in Terminal shell. You can also use this command to extract files from multiple compressed files from the particular directory.
You can use
shutdown command to turn of the system directly from Terminal shell. This command will shutdown the system exactly one minute after being executed. You can use shutdown -c command to cancel shutdown.
dir (directory) command can be used to view the list of all directories and folders present in current working directory.
cd command helps you to access particular directory or folder from the file system. You can also use cd .. command to go back to root.
As the name suggests you can use
reboot command to restart or shutdown the system from the Terminal window. There are several options available with this command as you can see in following screenshot.
sort <file name> command will help you sort file or arrange any record in particular order generally according to their ASCII values.
tac <file name> command will display the contents of the file in reverse orders as you can see in below screenshot.
exit command can be used to close the Terminal shell window directly from the command-line.
ionice command will help you get or set I/O scheduling class and priority for the particular process.
diff <file name1> <file name2> command will compare the two directories and will display difference between them
There are many commands available for Linux to retrieve hardware information but if you want information of a particular hardware component then dmidecode is the command for you. It offers various options and you can view them using
If you want to perform quick calculations during your work then
expr is really useful command for you.
gunzip <filename> command can be used to extract or restore files compressed with gzip command.
hostnamectl command can be used to access system information, change the system hostname and other related settings.
iptables is a simple Linux Terminal based firewall tool which helps manage both incoming and outgoing traffic using tables.
killall <process name> command will kill all the programs matching the processes name thrown with the killall command.
This command is for those who need to monitor incoming and outgoing network connections continuously.
netstat command displays the network status, routing tables and interface statistics.
lsof command will help you view all the open file related to your application in the Linux Terminal window itself. There are several options to customize the output and you can see the whole list in the below screenshot.
You can use
bzip2 <file name> command in the Terminal window to compress any file to .bz2 file and use bzip2 -d <compressed file name> command to extract the files from compressed file.
service command will display results of System V init scripts in the Terminal window. You can view the status of particular service or all the services
vmstat command will display systems virtual memory usage on Terminal window.
mpstat command will display all the information about CPU utilization and performance stats on Linux Terminal window.
If you want edit or modify attributes of already created user account then
usermod <options> login is the best command for you.
touch command in Terminal window you can create empty files in file system and you can also change time and date i.e. is timestamp of recently accessed files as well as directories.
uniq is a standard Linux Terminal command when thrown with file, filters the repeated lines in the file.
wc command reads the file thrown with the command and displays word and line count of the file.
pmap <pid> command display the memory map of the pid you provide. You can also view memory map for multiple processes.
rpm -i <package name>.rpm command can be used to install rpm based packages on Linux. To remove rpm package use
rpm -e <package name> command in Terminal shell.
ssh acronym for Secure Shell is protocol which is used to securely connect to host system.
ssh [email protected]<IP/Domain Name> is the command to connect to host computer as a user.
telnet command uses telnet protocol to connect to another system as a user.
If you need to change the priority of the running processes then run
nice [OPTION] [COMMAND [ARG]…] in the Linux Terminal.
nproc [option] command will display the number of processing units allotted to the currently running process.
scp acronym for Secure Copy is the Linux command which can be used to copy files and directories between hosts on the network.
sleep <Number> command will delay or pause the execution of command for particular amount of time i.e. specified with sleep command.
If you need to breakdown large file into small file then use
split [option].. [file [prefix]] command in the Linux Terminal.
You can view the status of a file or an entire file system using
stat <file or file system name> command in Linux Terminal.
lsblk command reads the sysfs filesystem and displays the block device information on the Terminal window.
hdparm command you can handle hard disk and other disk devices in the Linux using Terminal shell.
chrt [option] priority [argument..] command is used for manipulating the real-time attributes of the process.
useradd [options] login command will help you add user account into your system
userdel [option] login command will let you delete any user account from the system.
usermod [options] login command you can modify any user account present on the system.