Most used and handy Linux commands (part_1)

Default featured post

This article is the first article of the most used and handy Linux commands series and in each article ten most useful and most used Linux commands are discussed. This article is dedicated to describe first ten most used and basic Linux shell commands with their useful switches. The commands which are going to be covered in this article are cd, ls, clear, pwd, date, sudo, su, login, reboot, halt. The commands are sorted base on their frequent in use, means that the most used one are described first and then the rest are explained. Before starting, it is good to know that each command has its own guide page which known as man page. So if you find that you need to know more about an especial command just type man before your command to access to full user-guide.

The following part expresses mentioned commands in details.


This command is one of the basic commands that everybody who wants to work in the text mode or simply with shell should know. The usage of cd is to change the path of the system. For example imagine that you are in your home directory and wants to change the path from home to your desktop easily you can do it with the use of cd. The overall usage of cd is written as below,

$ cd [directory_name]


$ cd /home/kasra/Destop
$ cd /

cd accepts different arguments which give more flexibility to the user. The first thing which probably you want to do after learning and use it to go to a directory is how to back one directory back or one path back. cd .. is utilized to direct you to one path back exactly like Back button in GUI or window manager.

The second thing which is really useful is to back to your home directory without using too much cd .. and just with one command. Using cd without any parameters do this for you. It redirects you to your home directory from any path easily.


The usage of ls command is exactly the same as old dir command which is used in DOS and Windows command prompt. It shows the content of the directory. It task is the same as window manager which shows files and content of especial window in itself.

The first switch which is necessary to know is -a. This switch shows all contents mean it shows hidden files and folders.

Hint: In Unix like systems for hiding files or folders . sign is used in front of the name of the file or folder.

The second switch is -s. This switch is used to show the size of the listed files. The given size does not have any measurement quantity; therefore it is difficult to read. So the third switch is -h which is used with -s switch to show the size of the files in Kilobyte, Megabyte, Gigabyte, and so on.

Hint: Switches could be used together like,

$ ls -ash


The usage of clear is really simple and robust. It is used to clear the screen and the equal command in DOS and Windows is cls.


If you do not know exactly which path you are at the moment you can use pwd command to tell you where you are at the moment.


Date command is used to get the current date and time of the system.


In Linux if you want to do some especial tasks or run especial commands (like mounting a file system) you need root (superuser) access to run them. Since in Linux using root user to login to the system is not recommended because the user has access to the system completely and one wrong command can damage to OS and causes failure in OS, therefore, on the necessity which you want to run some commands with root privilege you can use sudo before the name of command. Firstly, it will ask for your password and then it runs the command. Bear in mind that sudo command may not work on the all systems because the user is not eligible to use it and administrator limits the user.


Running this command gives access of root user to you. This command is locked by default in some Linux distributions like Ubuntu. If you sure and want to access to root user and it is locked then you can combine two sudo and su commands together to pass the limitation of Ubuntu. As a result to access to root user you can use the below command,

$ sudo su


This command is used to login to the system. It is useful especially when you are already login but meanwhile you want to login with the other user temporarily and keep your current session as well. For instance imagine that a system has two user accounts as Jacob and Jacob_Work. Now Jacob is already logged in but wants to access to Jacob_Work temporarily to do something. Therefore, login command can be used as followed,

$ login Jacob_Work


Running this command causes system to be restarted. In some distributions normal (limited) user cannot run this command and need superuser access.


This command causes system to be shutdown and such as reboot command in some distributions normal (limited) user cannot run this command and need superuser access.