The Basic Linux Commands Every Beginner Must Know

Photo of author

By admin

Linux Commanders for all the Beginners

Do you know that almost 90% of Internet servers use Linux? Yes. It is an open-source system that runs on commands. Windows may sound like the most popular operating system, but if you ask programmers, developers, and all the back-end technicians, a command-line interface is what they prefer.

Android, the operating system in your phone, is also based on Linux. Currently, there are several Linux distributions available on the market. Debian, Ubuntu, Fedora, Red Hat Enterprise, and Linux Mint are the most popular. Because this is an open-source platform, you can make any changes and start your own distribution.

This is why it is so popular around the world. Unfortunately, Windows is not at the top of the list due to its high price. A novice may find the GUI interface, as in Windows, to be helpful and easy, but once you learn command-line tools, there is no going back.

There are Linux commands which make things easier for Linux users. So, this beginner’s guide is for you to learn Linux CLI.

What are Linux Commands?

Before you learn about commands, you must know about “Terminal” or “Shell” or “Console.” These are nothing but different names to the same thing, a program where the user enters the commands, and the terminal sends it to the system to execute it. So, you can understand it as an intermediary between your command and the operating system.

These are also available in GUI, but the command-line interface is the basic tool. It is very simple. The Linux commands are used for almost every purpose, such as file creation, file manipulation, deletion, administrative tasks, general management, etc. You need to type in the command, and the task will be done.

You get your output through the same terminal. These commands are case-sensitive. Linux’s CLI is better than any other OS. Its simplicity in performing both simple and complex tasks quickly through commands makes it a pioneer in the CLI world.

The Basic Linux Commands

If you are a beginner and want to know the CLI, you must first learn the basic commands. But the commands are entered in a launcher. So, you need a system that has Ubuntu or other Linux Distribution running on it.

  • First, you must open the terminal.
  • In an Ubuntu 18.04 system, Go to the ‘Activities” on the top left and type “terminal” in it. You can also use other synonyms such as shell, console, and prompt.
  • In other versions of Linux, you will find it along with other application launchers. Or an easy way is to press “CTRL”+”ALT”+”T” on your keyboard.
  • A window will open up with some text on top. Again, it looks different in different Linux systems. Now, you have opened the terminal; it’s time to enter commands.

You must know these few things before you enter the commands.

  • The commands are case-sensitive.
  • You type your command in the same line as the prompt message. It is the odd text which means that the computer is ready for the command.
  • You get the result of the command displayed on the terminal.
  • After each output, you will see another prompt which means you can move forward with another command.
  • If you don’t see the command’s output but the prompt appears, it means that the command was successful, and you can move forward.

Here are the basic Linux commands you must know-

1 – pwd

The full form of pwd is print working directory. It is the default location where the file operations take place. If you want to make any changes in another location, you have to specify the path, else the shell will pick your default location.

You will learn the absolute path of the directory with this command, which is generally the home directory. This path starts from the root.

The command looks like-

shelly@linux-desktop:-$ pwd


2 – cd

It’s an acronym for change directory. Unlike Windows, Linux doesn’t have distributed drives. Every folder stems from the root file itself which is denoted by “/”. So, if you want to change a directory and go to another one, you have to use cd command.

Say, you want to go to home directory, the immediate subdirectory of root, you type-

cd home


If you want to go to another folder named Documents, you type-

cd Documents


Remember, commands are case sensitive and usually you enter everything in lower case, but you need to enter a folder name exactly as it is, else, it will show an error.

Plus, if you enter a folder name which has more than one word, say “My Pictures”, you need to type,

cd My\Pictures


“\” denotes space, otherwise the system will read My and Pictures as different arguments and show an error.

If you want to go back to the parent directory, you use “. .” like shown below-

cd . .


If you want to go back multiple times, use “. ./. .”, like-

cd . . /. .


3 – ls

This is an acronym for list. This command lists down the folders which are present in the directory. To list all files you can use “ls – a”, as shown below-

shelly@linux-desktop:-$ ls




4 – mkdir and rmdir

These commands are opposite of each other. The mkdir is an acronym for “make directory”. Say, you want to create a directory called “Sounds”, you type-

mkdir Sounds

To create a folder with more than one word in its name like My Sounds, use it as-

mkdir My\Sounds

rmdir is the acronym for “remove directory”. It can be used in the same way as mkdir. Say, you want to delete the empty Pictures directory, type-

rmdir Pictures

To delete My Pictures directory, type-

rmdir My\Pictures

5 – rm

rm is the acronym for remove. You can remove files and directories with this command. If you simply use rm, it will delete the directory as well as its file content. Say, you want to delete both the contents of New Folder and the folder, use

rm New\Folder

If you only want to delete the directory and not its content, use rm – r in the following way.

rm – r New\Folder

6 – man

If you don’t know what a command does, you can use man command and it will describe what the command does. It shows the manual pages of the desired command. Use it as-

man cd

It will display everything you can do with the cd command.

Executing Linux Commands

So, now you have an idea about how to use a command. Now, let’s talk about a command and what it does, so you can execute them in the same way as the commands shown above.

  • touch: The command is used to create an empty file. Create a file easily with the command.
  • Cat: This is a multi-purpose command which can create, display and copy the content of a file, etc.
  • cp: This is the short of copy as this command is used to copy a group of files and directories.
  • Locate: This is a self-explanatory term. It is equivalent to search in Windows. You can locate any file in the Linux system using it.
  • Mv: This is an acronym for move.Use this command to move a file or directory group from one location to another.
  • Echo: This command helps you move some text data into a file. Say if you wish to move “This is my pen.” Into an existing file, you can write, echo This is my pen.>> new.txt and it will add the text. Here, the command is backed by two >> so you don’t need to place \ for spaces.
  • rename command: Again, it is a self-explanatory command which renames a file’s name. You can write it as- rename ‘s/Documents/Personal/’ files, to change the name of the Documents file to Personal.
  • head and tail command: A head command is used to display the first 10 lines of content in a file. The tail command displays the last ten lines of a file.

head <file name>

tail <file name>

  • Sudo: When a command is preceded by sudo, it means that the command is to be executed using the super user privileges.

E.g. sudo apt install

  • Df: Unlike Windows, Linux does not distribute disk space and it does not reflect free disk space generally. To know the free disk space, you can use the df command. You can request for the result in MBs or KBs. You can use it as “df –m” to know the free disk space in MBs.
  • Du: To know the usage space of a file in your system, you use du command. Say, you want to know the disk space used by “New Folder”, you can write it like-

du New\Folder

  • zip and unzip commands: To convert a file into a zip file, zip command is available. To unzip a file, you have the unzip command at your discretion.

Final Words

The commands stated above are only a glimpse of the basic commands used in Linux. For example, creating a file, modifying a file, moving it, copying it, deleting it, renaming the file, etc., are the most basic commands one uses. Apart from this, there are several other commands such as apt-get, ping, uname, more, tac, help, chmod, dir, dirname, compress, chroot, case, bc, apt, aptitude, ar, date, export, fdisk, find, finger, function, halt, hash, etc.

When you start using these commands, you learn that it is easy to remember them. The commands are the acronym of the function you want to undertake, such as mv for move, cp for copy, rm for remove, etc.

Practice can make you perfect. Start trying these Linux commands, and you will get into the rhythm. As you learn to execute simple ones, you can then try undertaking other operations as well. By experimenting with these commands, you will gain a better understanding of how commands work. A complex operation will be difficult for you to comprehend, but you will understand which files are changed, what command starts and stops, what files are modified, etc. Hopefully, these Linux commands will help you learn the Command Line Interface.

Leave a Comment