35 Useful and Basic Linux Commands You Should Know

It would be an interesting thing for you to know that Linux has merely a 2% share in the global market of operating systems. But you will be surprised to know that more than 90% of the global cloud computing and web hosting services use Linux operating system. And it is highly popular among developers and professionals.

Hence, it becomes essential for any beginner or individual who is into IT must be familiar with some basic Linux commands.

It is also a misconception about Linux that it is one of the most complicated and tough operating systems that are exclusively available for Developers which is not true. So, in this post, we try to bring all the important information regarding Linux such as its true meaning, how it works, how it is different from other existing popular operating system and try to clear all the misconceptions about Linux that you might hear.

What is Linux?

Screenshot 5 1 35 Useful and Basic Linux Commands You Should Know

Launched in the year 1991, Linux is a collection of open-source Unix operating systems such as Ubuntu, Devian, Mint, etc. that are developed on the Linux kernel. Since Linux is an open-source operating system and users can easily modify it and share it among others without any restrictions, it gained huge popularity ever since its initial release.

Like any other Operating system, you will be required to have an interface through which you can access and perform different operations on an operating system. This interface in Linux is known as a shell. To make it more user-friendly and easier to access, the majority of Linux operating systems come with a Graphic user interface as their shell.

On the other hand, users can also access and perform different operations on Linux OS using a command-line interface (CLI). It is a very efficient, powerful, and quite a fast user interface in which a user can perform operations in a fraction of seconds by simply using basic Linux commands in CLI.

So, it is highly recommended for Linux users to learn about some of the basic command lines so that they can increase their productivity and reduce time.

What are Linux commands?

Linux commands are a set of instructions or programs that run on a command-line interface (CLI). A command line is an interface that acts as a medium between the user and the computer. Where a user has to give lines of text or commands on CLI. Then the CLI processes these commands and gives instructions to the computer.

This interface is commonly known as terminal in Mac Os and Windows cmd prompt.

Some Basic Linux Commands list

Before we introduce you to some basic Linux commands, you need to first locate and open your command-line interface first. But the steps for locating a command-line interface on Linux operating systems can be different in each distribution.

However, in most cases, you will easily find the command line in the utility section of your Linux OS.

Command-line interface: Terminal

Now, here we go the list of some basic Linux commands.

1. Linux command: pwd (print working directory)

When you open the terminal, by default you are in the home directory of the user and the pwd Linux command helps you to know which directory you are currently in. It displays the absolute path of your current directory. This means, the complete path from the root that starts with a forward slash (/). For example, if a user named “onworks” with the root directory will look like this:

Linux command: pwd

2. Linux Command: ls (list)

Now if you like to see the listings of contents in the directory, use the “ls” command in the command line. There are multiple variations you can use with the ls command that help you to view more folders/files. such as:

ls -a will show all the hidden files.

ls – l will show some extra information such as date, type of file, etc.

ls -R will show all the files in the subdirectories too.

Linux Command: ls

3. Linux command: mkdir (make directory)

The mkdir Linux command is used to create a new directory in the shell. All you need to do is have a unique folder name and make ensure that it does not already exist in your shell and you are ready to go.

For example, if you want to create a directory named dir1, you need to type,

as shown in the picture below:

Linux command: mkdir

4. Linux command: cd (Change directory)

This command is one of the very popular Linux commands after ls and it helps you to easily navigate or switch to different directories or folders. All you need to have is the location of the destination path or folder name, depending upon your current location and you are ready to go.

For example: if you want to go to dir1, just type,

Linux command: cd

The prompt will show you the current location which is dir1 and when you type pwd along with dir1, it will show your path location i.e /home/onworks/dir1.

Linux command: cd

If you want to go back 1 level up, into the home, there are some shortcuts you can also use such as:

cd.. The two dots will navigate you back to one level up.

cd~ this will get you back directly to our home.

5. Linux command: touch

The touch Linux command will let you create a new blank file through the command line. All you need to do is type,

For example, you have to create a text file name file1.txt using the command line, the command would be touch file1.txt.

Linux command: touch

6. Linux command: cat (Concatenate)

This is also one of the most popular Linux commands, with the help of which you will be able to view, create and concatenate files directly on the terminal without opening a graphical text interface.

For example, if you have created a text file named file1.txt and you want to know the content in it, all you need to do is to type,

and the output will display the content present in it. such as if file1 has textual content “Hello world” written in it. It will be displayed on the terminal as shown below:

Linux command: cat

7. Linux command: Less

With the help of less Linux command, you can easily page down the text file and see the whole content on one page at a time.

This is the result that will be shown on the terminal.

Linux command: Less

8. Linx command: mv (move or rename file)

If you want to move or rename files and directories, you need to use the mv command in Linux. To use this command, you need to type your existing/old file name and then the new name or the destination.


For example, if you are renaming file1.txt to file2.txt, you have to type the Linux commands as shown in the picture below:

Linx command: mv

9. Linux command: cp (Copy)

Now you can also copy files from one directory to another using the cp command. Let’s say you want to take file2 to create file1 but also keep file 2. All you need to type,

Linux command: cp

Now the contents in file 2 will be copied into file 1 without affecting the contents in file 2.

10. Linux command: rm (remove or delete)

Now, after knowing how to create and copy files in Linux using the command line, it will be very helpful for you to know how to remove or delete files or directories. You can use the rm command to permanently remove or delete files.

Hence, you need to be careful while using this command because, if a file has been deleted or removed it cannot be recovered back. It is better to recheck the file or directory and make sure before proceeding further.

For example, to delete a file1.txt, you need to follow this command:

To remove a directory named dir2, you need to follow this command:

Linux command: rm

11. Linux command: which

The “which” command will search for a file or folder location and give you the output of that location. For example, suppose you are looking for a mongo application location, which is the MongoDB server.

However, if it isn’t able to recognize the query it will give an output as an error.

Linux command: which

12. Linux command: history

The history command turned out to be very helpful if you have been using Linux for a certain period. Especially when you have already run so many commands and at some point, in time you want to review all your previous commands. On the other hand, if you are unable to recall commands that you have used earlier, you can easily go back to the history and check out the complete list.

When you type ” history”, the result will show your all-past commands.

Linux command: history

13. Linux command: Sudo (Superuser do)

The Sudo command enables a user to perform certain tasks that are either restricted or require admin permissions. This is how Linux protects itself by restricting users to install any third-party packages or make changes to the system files.

This command is generally used to edit or modify certain files and to install software that is outside of the user’s home directory. However, you should not use this command for general purposes, or else it can generate errors if you make even a slight mistake.

Linux command: Sudo

When you type sudo, the terminal will ask password to run the command.

14. Linux command: top

If you use the top command, they will show you the processes, and how much memory and CPU are consumed in the system. It is somewhat like the task manager that you find on Windows devices. This comes in handy to eliminate those processes which consume too many resources.

This is how it shows complete processes running on the system:

Linux command: top

15. Linux command: df

The df is another command that will show you how much disk space is left. The output will be shown in percentages as well as in Kb.

Linux command: df

16. Linux command: lsusb

The lsusb command will show the devices like USB hubs, USB buses in the system, and all the devices connected via USB to them.

Linux command: lsusb

17. Linux command: shutdown

The shutdown command will let you either completely turn off the computer or you can also reboot your system. If you want to power off your system type,

However, you can also set a time and schedule your system power off in 24hr format.

18. Linux command: uname (UNIX name)

The name command will show all the information about your Linux system such as operating system, kernel, etc. Although the simple uname command is not that useful and doesn’t provide detailed information, it is advisable to use it with the (-a) flag, which helps in to show all the information.

Linux command: uname

19. Linux command: exit

From the name itself, you can get an idea of what this command is capable of. You can use this command either to close a current session or close the terminal.

20. Linux command: head

The head command gives you an output of the first 10 lines (by default) of any text file. However, you can also decide how many lines you want to view using the -n argument. For example, if you want to view the first 3 lines of a text file and you need to type:

Linux command: head

21. Linux command: tail

The tail command has similar functions to the head command. But the main difference is, that instead of displaying the first lines of a text file, the tail command will display the last ten lines of a text file.

For example, if you want to view the last 3 lines of a text file, you need to type:

22. Linux command: ping

The ping command lets you know the network connectivity status with a domain or IP address. Suppose, if you use the ping command along with anydomain.com, the command will check the connectivity status of anydomain.com and its response time.

Linux command: ping

23. Linux command: unzip and zip

The unzip command lets you extract all the contents from the zip archive. For example, if you want to unzip a zip file say xyz.zip. You need to type:

Similarly, you can also compress any file into a zip archive using the zip command.

24. Linux command: kill

The kill command comes in handy when you found any of the programs that are running and it becomes unresponsive and you are unable to stop or close the program. You can directly terminate it by using the kill program.

When you use the kill command, it sends a signal to the unresponsive app and instructs it to terminate itself. To kill any program, you can use either its process ID or the name of a program.

Note: Be careful while using the kill command, because if anything went wrong you might lose the work you are currently doing.

25. Linux command: wget (world wide web get)

To download any file from the internet, you can use wget command. Since you can download files from the internet, it has the largest collection of flags available.

For example, if you like to download a file from the download link: https://downloadlink.com/, you need to use the command as follows:

26. Linux command: echo

The echo command is generally used to add or move some data into a file. for example, if you want to add some text “welcome to my world” into the file1.txt file. You need to type,

This command can also be used to display simple texts on the terminal, for that you need to type.

Linux command: echo

27. Linux command: passwd

With the help of passwd command, you can change the password of users’ accounts. When you type the passwd command, a prompt message will appear asking you to type the current password. After that, you will be required to type the password and confirmation.

28. Linux command: chmod

With chmod command, you can change the permission of a file or directory instantly. You can make a file or directory either readable(r), writable(w) or executable(x).

For example, if you want to give execute permission to a file, the command will be as follows:

29. Linux command: wc (Word count)

The wc command is used to determine the number of words in a text file.

Linux command: wc

Input command:

The output will be displayed as:

  • where 2 represents the number of lines,
  • 6 shows the total word count,
  • 32 byte shows the size and
  • file1.txt shows the text file.

30. Linux command: locate

The locate command in Linux helps you to locate a file in the Linux system. It is somewhat similar to the search feature in the window system. This command comes in handy when you do not know the exact location of saved files or file names.

Using it with the -i flag, helps in to ignore the case and show results in both upper and lower cases. For example, suppose you want to search a textual file that has a “hello world” written in it. You need to type,

It will give you a list of all the files in the Linux system that have the words “hello world”.

Linux command: locate

31. Linux command: nano

If you want to edit text files, the Linux system has nano and vi text editors by default. With the help of this command, you can create a new file and modify it directly using the editor. It is basically pretty easy to use and supports many languages.

Now, let us understand it with an example, if you are going to create a new text file (file1.txt), you need to type

After that, an editor will be open where you can edit and save your file by using the combination Cntrl+X. After that select “Y” for Yes or “N” for No.

Linux command: nano

32. Linux command: whatis

The “whatis” command is used to view a single-line description of any other command. This command can be helpful if you are looking for meaning for any new command.

For example, if you are looking for the meaning of whatis command itself by typing

you will have the following output as shown in the picture below:

Linux command: whatis

33. Linux command: whoami (Who am i )

From the command name itself, it is clear that it is used to find out the current username.

Linux command: whoami

34. Linux command: diff (difference)

The diff or difference command is used to compare or find out the difference between the contents of the two files. The output of this command will display the lines that are not matched.

Linux command: diff

35. Linux command: grep

The grep command is another most basic Linux command with the help of which you can search thoroughly in the given file. For example, suppose you have to search world in the file1.txt, for that you have to type,

Linux command: grep


Although there are plenty of Linux commands available, these are some of the most basic commands that every beginner must be aware of. It will take time for any beginner to learn and remember these Linux commands but once they are able to master them, nothing can stop them from easily managing their VPS as well as Linux systems.

If you have any doubt or would like to add more basic Linux commands to our Linux command list, please do let us know in the comment section below.

Frequently Asked Questions

What are the commands in Linux?

some of the Basic Linux commands are:
1. nano – It helps to create a blank text file.
2. pwd – display your current directory
3. ls – shows the list of the contents in a directory
4. mkdir – creates a new directory
5. cd – change directory

How do I learn Linux commands?

To learn Linux commands, the best thing you can do is to practice with basic commands on the terminal. For example, to check the current directory use “pwd” command on the terminal or to create a text file using the “touch” command on the terminal.

How many commands are in Linux?

There are more than 100 UNIX commands available.

Leave a Reply

Your email address will not be published.