Basic Linux Commands For Beginners: With Examples [Visual Guide]

basic linux commands for beginners

Hello friend, and welcome to the Basic Linux Commands Tutorial For Beginners.

In this post, you are going to learn the fundamentals of Linux command line that will help you do get your hands wet in the Linux world.

With that said I’m also going to make sure not to overwhelm you with unnecessary information or any in-depth working of a command, but at the same time making your understanding clear.

I’ll be showing you the syntax of the command and giving an example with it so that you can try them on your own Linux machine and understand a command better.

This is a completely practical tutorial and you must implement these commands, in order to get hold of it properly.

You can either try these commands on your personal Linux machine or you can just go to linuxcontainers and you will be provided with a free Linux server session where you can practice these basic Linux commands.


Without any further ado, Let’s do this…

Basic Linux Commands For Beginners With Examples:

Learning the Linux commands at first can be difficult for a new user but with time and practice, you will get good at it. A the end of the tutorial I have also added a list of Linux of commands that are used in this tutorial. You can use that list for you reference when practicing commands on your new Linux machine.

What is Command?

A command is nothing but a set of instructions that are predefined for a specific word. In other words, a command is a program. It is a program that has been assigned specific a word.

What Is A Linux Terminal?

Basically, the terminal is a medium through which you can tell your Linux Operating System to perform a specific task.

The Linux Terminal is also referred to as Shell. You can control each and every aspect of your Linux Operating System from the Shell itself, which makes it a very powerful utility to have on any Linux-based Operating System.

Did You Know?
Linux Operating System is case sensitive i.e. lower case alphabets are different from uppercase alphabets. For example, ABC is different from abc.

So keep this thing in mind while creating files and directories.

Basic Linux Commands With Examples:

First of all, open the run dialog box by pressing ALT+F2.

The run dialog box will be opened and then type gnome-terminal and hit enter.

linux commands basics

Your terminal will be opened. If not, then you can manually search for the terminal in your Linux distribution.


This command stands for print which directory, and this does exactly the same thing i.e. to print the name of the directory in which you are currently working in.

Just type pwd and hit Enter.


The next command I’m going to tell you about is the ls command.

This command simply lists the files and directories inside your current working directory.

Now, Linux also offers us various options which are used with a command. These options are also known as switches.

So, let us take a look at the –l switch which is used with the ls command. The ls –l is used for listing the files with its details.

Type ls –l in the terminal and hit enter.

Now you can see that the output has returned some additional information about the files and directories.


The cd command stands for change directory and it does exactly what its name suggests.

This command is used to navigate to a  different directory.

The syntax for cd is: cd <directory_name>

Example: cd Documents


This command is generally used for updating the time stamp of a file when it was last modified.

But we can also use this command for creating a new file. Just type touch <filename> and hit Enter.

Example: touch newfile


The nano is a simple text editor in the Linux based Operating Systems, and it comes preinstalled with almost all of the Linux distributions.

The nano is very simple to use and is very beginner friendly.

To launch nano editor just type: nano <filename>

Example: nano newfile

You will be presented with a new screen which looks like this:

Notice, that nano editor also displays some shortcuts at the bottom. The caret (^) symbol stands for CTRL.

When you are done editing your file, Just hit CTRL X.

Then it will ask, whether to save your file or not. Hit y for yes or n for no.

At last, it will show you the file name, you can either modify it or simply hit Enter to save the file with the existing name.


The cat command is used to display content of a text file.

The syntax for cat command is: cat <filename>

Example: cat newfile


At this point, you know how to create a new file, then display the content of that file and how to edit that file.

Now let’s create a folder/directory where you can store all your files or subdirectories.

The mkdir command which stands for make directory is used for creating new directories.

For creating a directory use this command: mkdir <directory_name>

Example: mkdir new

Let us discuss a very useful switch of the mkdir command i.e., -p

So suppose, you want to create a new directory inside of another new directory and so on. You can use the mkdir command with –p switch to handle your situation.

Example: mkdir –p new/new1

If you don’t use the –p switch you can’t create a new directory inside a new directory.

Take a note on how I used the (last) ls command with the directory name for displaying content inside it.


So, now you know how to create a directory. Let’s take a look at the command which helps us to remove a directory.

The rmdir command which stands for remove directory is used for deleting/removing directories.

The syntax for rmdir command is: rmdir <directory_name>

Example: rmdir new

Just make sure that the directory you are removing has no content inside it. In other words, you can only delete an empty directory using the rmdir command.

To know how to delete a directory having content inside it, just keep reading.


The rm command stands for remove. The remove command is generally used to remove/delete files.

We can use the switch –r with the rm command to remove a directory which is not empty.

The syntax of rm command is: rm <filename>

Example: rm newfile

To remove a directory having content inside it just use –r switch with the rm command.

Example: rm –r new


Now let’s look at some other basic operations which we can perform using the Terminal/Shell.

The mv command. This stands for the move. The mv command helps you to move one file from one location/directory to another location/directory.

The syntax for mv command is: mv <source> <destination>

The source is the file or directory which you want to move and the destination is the location where you want to move your file of the directory.

Example: mv new.txt new

You can have multiple source files separated with space but a single destination directory.

Example: mv new1 new2 new3 dir

Here, new1 new2 and new3 are the source files and dir is the destination.


As you might have already guessed, this command stands for copy and helps us to copy files from one location to another location.

The syntax for cp command is: cp <source> <destination>

Example: cp newfile new


Some Tips!
  • There is a lot more, that you can do with these commands by using different switches available for each command.
  • You can always look for switches available for a specific command by using the man command. Like: man cd or man ls and so on.
  • Use the Tab button for auto-completion.
  • Suppose you are typing this command in the home directory: cd Doc after you hit Tab button this will be autocompleted to cd Documents.

Linux Terminal Commands

So here is the list of Linux commands that are used in this tutorial. You should implement these Linux terminal commands on your computer one by one to really understand what a command actually does.

As I said in the beginning, Learning these terminal commands may seem difficult to you if you are a total newbie. But don’t worry, you will gradually get good at it.

List Of Linux Commands

Command Usage
pwd Used to print the current directory/folder name
ls To list all the files and folder in your current folder
cd Used to change your directory
touch Updates the timestamp of a file
nano A command for opening the nano text editor
cat Generally used to display the content of a file
mkdir Create a new directory/folder with this command
rmdir Helps you to remove or delete a directory/folder
rm Used to delete a file. Combined with -r switch it can delete a folder which is not empty
mv Move your files to a new location
cp Used to copy your files

Rundown: Basic Linux Commands For Beginners With Examples

So, this was all about basic Linux commands for beginners. Now you know how to perform basic tasks using Linux shell.

By knowing these basic Linux commands you have laid down the foundation of becoming an expert in Linux.

But in order to become a Linux power user, you must have a solid understanding of the Linux Shell. And I’m going to walk you through your journey, from a basic Linux commands user to a Linux power user.

The Linux shell is much more powerful than just performing these simple tasks. Read the follow-up tutorials to become an expert in using the Linux terminal.

You’ll be learning a lot of Linux shell commands in these tutorials. So don’t wait and check them out ASAP.

Also, implement each of the commands on your Linux machine. This allows you to better consume the content and helps you to remember the commands that you are typing. Not to forget, it will be a lot of fun following the tutorials in this way.

So stay tuned and subscribe by clicking on the bell icon to get the updates notifications. And if you liked this post, please do share it with your friends. If you have any problem, query or a suggestion for me let me know via comment section. And keep visiting Hackingpress.