Hello Sunil
Linux Commands Cheatsheet

Linux Commands Cheatsheet: Basic Linux Commands

Linux is  created by Linus Torvalds which is free and open-source for distribution. It is mainly used in servers because it is fast, secure, and free. There are several Linux distributions available in the market which are commonly known as “Distros”. Some of the famous Linux distros are  Ubuntu, Red Hat Enterprise, Linux Mint, Debian, Fedora, CentOS and OpenSUSE.

In Linux, we need commands to carry out our tasks. Whether you want to install a package or need to do file manipulation. Commands are important and this task is done by “Linux Terminal” or “Bash shell”.

It is a program that receives commands from the user and gives it to the OS to process, and it shows the output. This terminal is just like command prompt of Windows OS. But remember Linux commands are case-sensitive.

In this article we will learn some of the most basic Linux command for Windows user. This article will be longer one so that it is recommended you can bookmark it on your browser for later read.

Outline of this post:

  • Set up Linux environment on Windows 10
  • Try out basic Linux commands

How to set up Linux environment on Windows 10 

You can install any of the Linux distribution on your computer to test out Linux command. But we are going to use Ubuntu Bash shell on Windows 10 with the help of Windows Subsystem for Linux (WSL). WSL allows you to install and run Linux Bash shell on your Windows 10 PC.

If you need occasional access to a Linux Bash shell , then WSL is a good option because it starts very quickly. In our previous post we have written step by step guide to install Ubuntu Bash shell on Windows 10, which you can read it from here:

How to Install and use Windows Subsystem for Linux (WSL) on Windows 10

Try out basic Linux commands

We have done installing Ubuntu Bash shell on Windows 10 PC successfully as mentioned in our last section. Now you are ready to try out basic Linux commands. Here are the most basic Linux commands which you can try on Ubuntu Bash shell.

1# pwd  – To know which directory you are in, you can use “pwd” command. It stands for “Print Working Directory.” It gives us the absolute path which starts from the root. The root is the base of the Linux file system. It is denoted by a forward slash( / ).

Linux basic command - pwd 

2# mkdir  – This command is used when you need to create a directory. For example, if you want to create a directory called “Asia”, then you need to type “mkdir Asia”. Again, create another directory called “Russia” by typing “mkdir Russia.” 

Linux basic command - mkdir 

But if you want to create a directory named “Learn Linux”, then you can type “mkdir Learn\ Linux”.

Linux basic command - mkdir (two words)

3# ls – We have created three directories and their names are “Asia”, “Russia” and “Learn Linux”. But how can you conform these directories are successfully created. You can do it by using “ls” command. It stands for “List” which is use to know what files are in the directory you are in. So that simply type “ls” which gives us three directories as mentioned below:

Linux basic command - ls

Remember you can see all the hidden files by using the command “ls -a”.

Linux basic command - ls -a

4# cd – Use the “cd” command to go to a directory and it stands for “Change directory”. For example, if you want to go to the “Asia” directory, then you can type “cd Asia”. Remember, this command is case sensitive, and you have to type exactly as it is.

Linux basic command - cd

Let’s create another directory inside “Asia” and call it “India”. If you want to go from “Asia” directory to “India” then type “cd India”.

Linux basic command - change directory from Asia to India by using cd command 

But if you want to come back to “Asia” directory again then simply type “cd ..”. The two dots represent back.

Linux basic command - cd ..

But remember if you just type “cd” and press enter, it takes you to the home directory.

Linux basic command - if you do not add any parameters then cd command will take you to home directory

5# rmdir  – This command stands for “remove directory” and used to delete an empty directory. Let’s do the practice. We had created a directory named as “India” inside of “Asia” directory. But remember “India” is an empty directory and it does not hold any files so let’s delete this directory by typing “rmdir India”.

Linux basic command - rmdir

As you can see when we type first “ls” command, we got “India” directory inside of “Asia”. But after deletion of this directory by “rmdir” command, we got empty directory for “Asia”. But what if, we have files inside of a directory. In this case we can use “rm” command which deletes the files it contains. But if you use “rm -r” command then it delete directory and the files it contains.

Sunil Pradhan

Developer, Explorer, Learner. My hunger and curiosity drive me forward in directions I want to go.

1 comment

  • Good commands.
    Please mention more advance commands like awk,netstat,vmstat,ifconfig,scp,sftp,

Stay Updated

Want to be notified when our article is published? Enter your email address below to be the first to know.

Sunil Pradhan

Developer, Explorer, Learner. My hunger and curiosity drive me forward in directions I want to go.