An introduction to the Linux command line

One of the most powerful tools while using Linux is the Linux command line. You see, Linux was never meant to be used as a desktop. In the initial days of Linux, it was completely used without a graphical interface right in the server room. That's why the Linux command line is so powerful.

Before talking about anything we need to get some basics in place.

Everything in linux is a file.

Whatever you see in Linux is a file. Period. Devices are files, drives are files, your keyboard is a file and so is your mouse. A directory or a folder means a file that contains the names and permissions of other files. This also means that you can unknowingly delete all your keyboard drivers. Of course, Linux will not let you do that unless you are a superuser.

Superuser = Superman.

Linux has a concept of the root user, better known as the Superuser. A Superuser can do or change anything in your system. 

Never do anything as a superuser unless you know exactly what you are doing

The biggest problem in Linux is that it let's you do whatever you like. This can be anything from deleting some configuration files to deleting your root directory. If you do something stupid as the superuser, you can end up with a super broken system which might take a lot of time to fix. To become the superuser, open up your terminal and type in su 

It will then ask you the root password, and kaboom you are the superuser. The way you can confirm that is by observing your terminal. If it ends with a $, you are not the superuser. But, if it ends with a pound symbol ie # you are the superuser. 

For example,

[insaanimanav@manav ~]$ -----Not a superuser 
[root@manav insaanimanav]# ----- superuser

Some basic commands

The absolute bare minimum you need to know while working in a linux system is navigating directories. 

Before we go ahead, we need to know the directory structure in Linux. To do that, Open up your terminal and type in

cd /

Don't worry about these commands. We are going to talk about them in just a second.

You are going to see an output similar to this.

shell bin dev home lib64 mnt proc run srv tmp var boot etc lib lost+found
opt root sbin sys usr

Now, this is your main directory structure for Linux. Let's talk a little bit about this.

1.bin -> This is what contains the binary files for all your programs. -> This contains all the devices and their drivers.

3.home -> This is the primary directory where you will be staying most of your time. All your stuff will be in there.

4.boot  -> One of the most important directories is the boot directory. As the name suggests, boot consists of all the information that is required by your system to boot.

If you ever find yourself changing anything in the root directory, take a step back and ask yourself, “What am I doing exactly?”. If there is a reasonable answer to this, then go ahead. Else, please don't.


cd stands for change directory. Putting the directory name in front of the cd command lets you change to that directory. A little caveat is that /home/username is your main home directory, which is the default for all terminal editors, and it is also aliased to ~.

The following two commands perform the same function:

cd /home/insaanimanav/Videos
cd ~/Videos 

This is probably the single most useful command that you will use while using the command line.


This is a small utility command which tells you which directory you are in.



The second most useful command after cd is ls . ls is short for listing. As the name suggests, this lets you list the contents of a directory. Now, with ls, let's talk a little bit about the options available.


This does the long listing of files. This means that you will see more information about a file such as the permissions.


This lists the hidden files as well. Hidden files are the files whose name starts with a dot. For example, .bashrc ,.zshrc, etc.


shell ls # lists the files 

ls -l # long listing of the files 

ls -a # list all files including hidden files 

ls -al # combine both the options and show a long listing of all files including hidden files


Another small utility command which lets you make directories. 

If you just type mkdir and the name of the directory after it, you will see that the directory is created in the same directory that you are currently on. And if you pass a path to the mkdir command, then the directory will be created in that path.

For example,

mkdir name 
mkdir /path/to/the/directory 


This command lets you remove stuff from your machine. 

For example,

rm name 

This will remove the file name that you specify. 

Like all the other commands, this will remove the file in the current directory. Pass a path to this and it will remove the file at this path. 

Now, as we initially pointed out, even a directory is a file. So, can rm delete it? The answer is yes, but you have to provide it another option. 

For example, let us say Ramlal is the name of any directory. So when you write rm -r Ramlal, the -r tells it to delete the contents inside it too. It stands for recursively. 

What if you want that rm should ask before deleting the directory? Then you should use -i option with rm.

rm -i Ramlal

Sometimes, files are protected in nature and when you run rm on them, then you may get an unable to delete error. 

To fix this, you should run rm with the -f option

rm -rf Protected_Ramlal 

That's all the basic commands you are going to need for moving around in any Linux based system.

If you want to see more Linux based tutorials on Tuesdays, then let us know down in the comment box. 

Also, stay tuned because this thursday we will be talking about KDE connect - "The companion app that we all deserve".


Popular Posts