Basic LINUX & Terminal Commands for Beginners

To learn how to use the LINUX terminal for your projects this article will guide you through the basic commands commonly used and with the examples, you will be able to use the terminal and do necessary operations easily.

Why Learn these Command?

Knowing the command line gives you full control over the machine. You can use these commands to change permissions, create directories, view hidden files, manage processes, etc.

By Learning these commands you can perform tasks much faster than using a GUI.

You could automate many tasks like creating 1000 files with unique names, searching for a string and replacing it and so on.

These commands are platform-independent. You can run these commands on LINUX, MAC and on Windows machines.

For MAC users already have LINUX so just go to the terminal and start typing these commands.


whomi command is to print the user name of currently logged in to the terminal :

whom command in LINUX


man <command>

means manual, it helps you to find how to use a command and gives a brief description about it: 

You can then press q to quit the window that will open which displays the manual page.

Man command in LINUX
Manual page of whoami


clear command clears all the previous written commands on the terminal screen. You could give an option with the clear command say clear -x, this command does not clear your scroll history.

If you don’t like to type this command there is a shortcut you can use to clear control+l


This command stands for Print Working Directory, it prints the current folder pat you are in. Default is your home directory, now  I am inside the documents folder.

pwd command in LINUX


This command lists all the files inside the folder. If you add a folder name or path to this command, it will print the contents inside that folder. ls -l option -l gives the file size and permission.

ls command in LINUX
ls <folder name> command in LINUX
ls <path name> command in LINUX


This command stands for Change Directory. If you have a folder you can move into it using the cd command. To use this command invoke it specifying a folder to move into. You can specify the folder name or and entire path.

cd command in LINUX

The cd command is used to navigate into any folder you want, initally, I typed in ls command which lists all the folders and when I wanted to navigate to Desktop, give cd Desktop and by typing pwd command now I have navigated from home folder to my Desktop folder.

To go back type in, by using .. a special path that refers to the parent directory. If you want to go to your user name folder directly use cd ~

cd ~ command in LINUX


This command is used to create a folder. mkdir <folder name> eg: mkdir Test

mkdir command in LINUX

We can create multiple folders mkdir <folder name1> <folder name2>

eg: mkdir Sample1 Sample2 

We can create multiple nested folders by adding the option -p : mkidr -p Sample1/Eggs


This command creates an empty file using touch <file name> eg: touch Scripts

In this example initially, there were no files inside the Documents folder, once I give touch scripts and then ls we could see that the scripts file is created inside the documents folder.

touch command in LINUX

If the file already exists, it opens the file in write mode.


The rmdir command will delete the folder created, but the folder should be empty. You can specify the folder name or pathname rmdir <folder name> or rmdir <path name > eg : rmdir Test

rmdir command in LINUX


This command removes the files inside the folder. rm <file name> eg: rm test.txt

rm command in LINUX

Thank you for reading. Hope this article was helpful. Good luck and happy coding!