20+ Basic Linux Commands to Increase Productivity


Linux commands are the foundation of the GNU/Linux operating system, which is used to manage the entire system. Linux is the popular choice as an OS for servers. You may not realize it, but, in a Linux system, most graphical user interface programs run Linux commands in the background for you to complete the work.

Allowing the application to perform Linux commands for us automatically has several obvious advantages. However, the downside is that we are often unable to tailor the command execution to achieve the intended result.

Furthermore, if something goes wrong, the user is likely to be left in the dark with no idea where to start troubleshooting the problem.

The number of Linux commands available on your GNU/Linux system doesn’t matter because it varies from system to system. If you must have the exact number, run the following command on your terminal:

$ for i in ${PATH//:/ }; do ls $i; done | sort | uniq | wc -l

Now, this command will give the exact number of commands available for a particular system. But there are thousands of commands and learning each of them can be quite hectic, so let’s look into some of the basic Linux commands in the next section.

Basic Linux Commands

1. pwd

The pwd command helps to find out in which directory you are currently working in. This command will give the full path of all the directories that begin with the forward slash.

Example : /home/Dell

2. cd

Use the cd command to traverse across Linux files and directories. It requires either the whole path or the directory name, depending on the current working directory.

Example: Let’s imagine you’re in /home/Pictures and wish to browse to Photos, a Documents subdirectory. Simply type the following command to do so:

cd Photos

There are a few shortcuts that can help you get around quickly:

  • cd.. → Used to go one level up in the directory.
  • cd → To go to the home folder
  • cd- → Used to go to the last directory.

3) ls

To list the contents of a directory, use the ls command. This command displays the contents of your current working directory by default. There are a few variations in this command:

  • ls -a

Viewing all the hidden files.

  • ls -al

This will display a list of files and folders along with descriptive information such as permissions, size, and owner.

  • ls -R

This Linux command will also reveal all of the files in the subdirectories.

4) cp

To copy files from the current directory to a different directory, use the cp command. The command cp book.txt /home/username/Downloads, for example, would copy the book.txt file from your current directory to the Downloads directory.

5) cat

One of the most commonly used commands in Linux is cat (abbreviated for concatenate). It’s used to show the contents of a file on the standard output (stdout). To use this command, type cat followed by the file’s name and extension. For example, cat book.txt. Below points tell us how to use the cat command:

  • cat > filename

This command will create a new file.

  • cat file1 file2>file3

This Linux command will combine file1 and file2, and the output of both will be stored in file3.

  • cat filename | tr a-z A-Z > output.txt

You can use this command to convert the file into lower or uppercase.

6) mkdir

Make a new directory with the mkdir command. For example, typing mkdir Photos will create a directory named Photos. There are a few more variations of the mkdir command to try:

  • mkdir Photos/newFile: This Linux command creates a new directory within another directory.
  • mkdir -p Photos/2022/newFile: It will create a new directory in between the two directories.

7) mv

The mv command is primarily used to move files, but it can also be used to rename them. The mv command accepts the same arguments as the cp command. You must type mv, followed by the file’s name and the target directory.

8) rmdir

The rmdir command can be used to delete a directory. In contrast, rmdir can only be used to delete empty directories.

9) rm

The rm command can be used to remove folders and their contents. If all you want to do is destroy a directory, use the rm -r command instead of rmdir.

Note: Proceed with caution while using this command, and double-check that you are in the correct directory. There is no way to undo this, so be careful.

10) locate

This command, like the search function in Windows, can be used to locate a file. Furthermore, if you use the -i argument with this command, it will search for files in any scenario, allowing you to locate a file even if you don’t recall its specific name.

Use an asterisk (*) to find a file that contains two or more words. For example: locate -i book*test, this command will check for the files that contain book and test words regardless of their case.

11) touch

You can use the touch command to create a new file from the Linux command line. For example, touch /home/Dell/Documents/Data.txt will create a text file with the name Data in the Documents directory.

12) grep

grep is another basic Linux command that is extremely useful in everyday situations. You can use it to search through all of the text in a given file. For example, grep book schooldata.txt will look in the school data file for the word book. The whole line containing the desired phrase will be displayed.

13) sudo

This command, which stands for “SuperUser Do,” allows you to accomplish operations that require administrative or root capabilities. However, using this Linux command frequently is not suggested because it is easy for an error to emerge if something goes wrong.

14) df

To acquire a report on the system’s disc space consumption in percentages and KBs, use the df command. If you wish to see the report in megabytes, type df -m.

15) du

The du (Disk Usage) command can be used to determine how much space a file or directory consumes. The disc consumption summary, however, will show disc block numbers rather than the conventional size format. If you want to see it in bytes, kilobytes, or megabytes, add the -h argument to the Linux command.

16) head

To view the initial lines of any text file, use the head command. By default, it will show the first ten lines, but you can change this number to suit your needs. If you simply want to see the first ten lines, for example, use head -n 10 filename.txt.

17) tail

The tail command performs a similar function to the head command, except instead of displaying the first ten lines of a text file, it displays the final ten lines.

18) diff

The diff command, which stands for difference, compares the contents of two files, line by line. After reviewing the files, it will produce lines that do not match. When programmers need to make modifications to a program without having to rewrite the entire source code, they typically utilize this Linux command.

19) tar

The tar command is the most commonly used command for archiving several files into a tarball, which is a typical Linux file format comparable to zipping but without compression.

This command can perform a wide range of tasks, such as adding new files to an existing archive, listing the contents of an archive, extracting data from an archive, and so on.

20) chmod

chmod is a Linux command that allows you to change the permissions of files and directories in terms of reading, writing, and executing.

21) man

Are you unsure what some Linux commands do? Don’t worry; you can quickly learn how to use them by using the man command from the Linux shell. Entering man tail, for example, will display the manual instructions for the tail command.


Basic Linux commands enable users to complete tasks quickly and efficiently. Some of the basic commands may take some time to recall, but nothing is impossible with enough practice.

Finally, knowing and mastering these fundamental Linux commands will surely help you manage your Linux desktop. Happy Learning!

Share Your Thoughts, Queries and Suggestions!