Linux Commands Series 1 : 5 basic commands


Linux is a powerful operating system, it was first started by Linus Torvalds in 1991, released then as an open source operating system, it has since grown to become one of the most widely used operating systems, it powers a great fraction of the servers and the supercomupters in the world, and is the backbone of the dominant smartphone OS in the world : Android.

In this tutorial, I am going to introduce you to basic linux commands. A command is a program that comes bundled with Linux. Linux commands are very powerful, they allow you to do pretty much everything, from copying your files, moving them around, planning tasks, downloading things from the Internet,...So, Let's start !

In order to open the terminal, there are few ways :

  1. I am using Ubuntu 20.04, in this distribution you can open the terminal by going to activities at the top left of the Ubuntu Desktop, clicking, the search text area appears and you just type 'terminal' and the program will appear, double click on the icon :

terminal icon in Ubuntu

2. You can also use the keyboard shortcut : Ctrl+Shift+T

The terminal then shows : the command line displays the name of the current user, then an '@' then the name of the computer, a colon, '~' stands for the home directory of the current user, after the dollar is the space where we enter our command

the terminal UI

Now that we have opened the terminal, let us start with 5 basic commands in Linux :

1. pwd : This command stands for "Print Working Directory", it will print the directory you are currently in


==> /home/mounaim

pwd command

2. cd : This command stands for "Change Directory": it will take you from the current directory to the the directoty provided as parameter :

cd /music

cd command

the upper command will take you to the directory /music directory

here are some tips about cd command :

  • cd / : will take you to the root directory of the linux operating system

  • cd ~ : will take you to the home directory of the current user (also cd without any paramter gives the same result)

  • cd .. : will take you the parent directory

  • cd - : will take you to the previous directory

3. echo : This command will print whatever you give it as parameter to the terminal console

echo "Linux is a great operating system"

==> Linux is a great operating system

echo command

4. clear : this command will clear the screen, resulting in an empty terminal

clear command

the terminal window will become emtpy as in the next screen (but the commands are not deleted from history, we will see in subsequent tutorials how to retrieve them) :

terminal cleared

5. ls: this command lists the files of the current directory :

ls command

the directory Linux contains 3 files named file1.txt, file2.txt and file3.txt

In the next tutorial, we will go more in depth with the ls command . Don't forget to practice the ones you learned today, and if you found the tutorial useful, share it with your friends ;)

Happy Learning !