Become a Linux Terminal Expert Starting with these Basic Commands

Become a Linux Terminal Expert Starting with these Basic Commands

Linux has evolved over the years from a pure command line interface to the graphical interface that are available now in many popular distros such as Ubuntu, Linux Mint, Fedora etc. The UI has made a significant leap yet the functionality of Linux lies in its terminal. It is the most powerful tool that a Linux user must master.

Today, we will take a look at some of the necessary commands that would help you work around the terminal.

pwd (print working directory)

It is used to find the actual directory that the terminal is in, starting from the root.

$ pwd

mkdir (make directory)

-To create a new directory in the current working directory.

$ mkdir directoryName

ls (list)

-To list the files and directories in the working directory.

Show all files in current directory
$ ls
Show all files in a directory /mydir/some/path

$ ls /home/user/folder

Display details of all file in the list
$ ls -l
Display all hidden files as well (including the files name start with a do )
$ ls -a
Display all file that have names starting with my

$ ls my*

cd (Change Directory)

It is used to change the current working directory

$ cd /home/user/dir2

rm (remove)

rm command used to remove or delete a file without prompting for confirmation.

$ rm fileName

The parameter -i can be used to get a prompt before deletion, -r for recursively remove all sub folders and -f for force remove.

$ rm -i index.html

rm: remove regular file `index.html'?


The uname command is used to get information about the operating system and its kernel.

$ uname -a
Linux Gravity 4.2.0-32-generic #37-Ubuntu SMP Fri Feb 26 02:21:44 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

free command

It is used to gather information about the physical memory in run time. It displays the free, total and swap memory available.

$ free
                        total     used     free     shared      buffers     cached
Mem:                    3713756 2660276 1053480 267756 70036 902852
-/+ buffers/cache:      1687388 2026368
Swap:                   4882428 60 4882368

Vi editor

The VI Editor is a built-in editor that comes with most Linux-based operating systems. It provides a wide range of features that facilitate better code editing.

$ vi file.txt

Once you enter the command, you will be presented with a blank screen and that is your text editor. Type in the contents and hit :q to return back to the CLI.

Cat Command

It is used to view single or multiple file at the same time in the terminal itself. Basically, it prints the contents of the file in teh terminal.

$ cat file1

$ cat file1 file2


  • Returns the user name, date, time and host information when the system is connected to a network.

$ who

varun    pts/0          2016-04-22 18:00 (

W Command

It displays users currently logged in and their process along-with shows load averages. It also shows the login name, tty name, remote host, login time, idle time, JCPU, PCPU, command and processes.

$ w


Displays the number of minutes or hours the system remains logged in.

$ uptime

17:37:24 up 2:33, 1 user, load average: 1.08, 0.84, 0.55

SSH (Secure Shell)

It is used to log in remotely to another system.

$ ssh [email protected]

It prompts for the password, if necessary and gets you in to the remove system.


Used to search all the lines in all files in a specified location containing a string (Pattern Matching).

Search for a specific string “Varun” in a file file.txt
grep “Varun” file.txt
Search for a specific string “myname” with ignoring the case in a file file.txt
grep -i “myname” file.txt
Search for a specific string “User” in a all files in current directory
grep “User” *
Search for full word “Tech” in a file file.txt
grep -w “Tech” file.txt
Search a string “ByteKid” in all files in all subdirectories recursively
grep -r “ByteKid” *

Start off with these commands and try to fit them in for your daily usage. Using a GUI is completely fine but commands give an upper hand while performing administrative operations.

Any issues? Let us know in the comments section below.