Learn Linux Commands

Learn Linux Commands

Learn Linux Commands

Linux commands

In Linux, the command line is a powerful tool that performs complex tasks with very little effort. You can do lots of amazing things with commands in Linux and it’s not difficult to learn. If you are completely new to the Linux command line, then you should know that there are literally hundreds of Linux commands. But you need not to learn all those commands in order to use Linux mostly you will only need to use a very small subset of those commands.

Another important thing to note about Linux commands is that some commands are “distribution-based” – they can only be found in specific distributions. While others are generic Unix/Linux commands that you’ll find in all if not most mainstream distributions.

In this article, we will introduce you a list of most frequently used Linux commands which will help you getting familiarized with CLI (Command Line Interface) navigation, along with some basic file/directory operations. And we are going to do it with help of Linux cheat sheet.

What is a cheat sheet?

In IT training, a cheat sheet is a reference tool that provides simple, brief instructions for accomplishing a specific task.

Obviously in the beginning when you start learning Linux commands, it’s normal that you won’t know all commands. You will be able to learn commands only if you practice them on regular basis. But, if you have just started to work on CLI, cheat sheets come handy for quick references.

You don’t have to memorize, or Google for repetitive commands each time. Cheat sheet is a little doc can be opened in a corner of your screen or on a printed paper and you can have a look at every time you stuck at something using Linux commands.

Before we start getting familiar with Linux commands, one thing I want to clear is that I don’t own any of the cheat sheets, while I will be providing all the reference and download links but they all belong to third party websites.

Some Basic Linux commands

Using File and Directory Commands

# List all files – ls

The “ls” command displays the contents of files and directories that are located in the path that you are in.

For example if you are in /home/john and you type “ls”, this will display what’s in the directory /jhon.


# Display the present working directory – pwd

The “pwd” command displays the full path of the current directory or location that you are in.


#Change Directory – cd

The command “cd” is used to change directories, you type “cd” and then the path for the desired directory.

For example you are in /home/atulkumar/music  and you want to go to the directory /home/atulkumar, you will type ( cd  /home/atulkumar ( If you type ( cd . . ) or ( cd ) or ( cd ~ ) this will take you to your home directory.


# Create a directory – mkdir directory-name

The command “mkdir” us used to create new directories.

EX: (mkdir test), by this command you will create a directory by the name test.


# Remove (delete) file – rm file-name

“rm” is the command used for deleting directories or files.

EX: (rm newfile.txt ), by this command you will remove the file “newfile”.


# Remove the directory and its contents recursively – rm -r directory / RMDIR

The command “rmdir” is used to remove directories.

Ex : ( rmdir jack ) , by this command you will remove the directory ” jack ” note : this command rmdir removes only empty directories , to remove directories that contain files or other directories use the command ( rm -r ).


# Copy file1 to file2 – cp file1 file2

To copy files or directories you use the command “cp”. To copy a file you will use the command cp and to copy a directory you will use cp -r. Note that if you take a copy of a file in the same directory you will have to change the file’s name.

EX : you are in the directory /crib you have a file by the name ( file1.txt ) and you want to take a copy of ( file1.txt ) in the same directory , then you will type ( cp file1.txt file2.txt ) and this command will take a copy of the file ” file1.txt ” and the copy will be “file2.txt.


#Move file1 to file2 – mv file1 file2

To move one or more files or directories from a location to another location you use the command mv and then the directory or file name and then the path.

EX: mv /home/file1.txt  /home/atulkumar ,by this command i’ll move the file ” file1.txt” from the “/home” to ” /home/atulkumar”

“mv” command is also used to rename directories and files

EX: mv jack.txt jones.txt, by this command i’ll rename the file jack.txt to jones.txt.


# Create an empty file or update the access and modification times of file – touch file-name

To create files you use the command “touch”.

 EX: (touch cake.txt), by this command i’ll create a file by the name “cake.txt “.


# View the contents of file – cat file

The command “cat” is used to read the contents of a file. It is the most basic command for reading a file.

EX: cat car.txt


# Browse through a text file – less file-name

The command “less” is used to display the contents of large files. Unlike the cat command, the less command has more control you can scroll down and up .

EX: less car.txt

Linux Cheat Sheets Links

Cheat Sheet from Linux Training Academy

A – Z LINUX Command Cheat Sheet from TecMint

Linux command Cheat sheet from Linoxide

Linux command cheat sheet from Loggly


Share this Post:

Related Posts: