Top 10+ Linux Commands You MUST Know

Published on January 31, 2024

Whether you are new to Linux or an experienced user, there are some commands that you must know to simplify your activities and get around Linux with ease. There is power in using the command line, but unless you know some of the most popular commands and what they do, you may fail to harness this power. Luckily, we’ve prepared a list of the top 10+ Linux commands you must know. Take a look!

Complete Guide: Top 10+ Linux Commands You Must Know

The commands in this post follow a random order. Go through each and practice it on your terminal to get comfortable with what it does and how and when to use it.

1) ls

The list (ls) command lets you list the contents of a given directory. When executed, it will show all files and folders in the current location or the specified path.

Note that you can use the ls commands with different options to get other results. For instance, the ls -l option will long list the files and folders to get more details about them.

2) pwd

The print working directory (pwd) will give the path of your current directory. It is handy when you want to check the directory structure or get the path from the home directory to the current location you are in.

3) whoami

In Linux, you can check the currently logged-in user using the whoami command. Since it’s possible to have different users in one system, this command will help identify the currently logged user.

4) cat

You can use the cat command with the redirect sign to create a new file and add text to it.

You can also use it to read the contents of the specified file by adding its name without any redirect sign.

5) date

The date command will display the current date and time in your local time zone.

6) mkdir

When creating and understanding the Linux filesystem, the mkdir command lets you create directories in the current location or specify the path where to have the directory created. Type the command and the name of the directory you want to create.

7) cd

When you want to navigate between directories, the cd command lets you specify which directory you want to navigate to. For instance, we can switch to the directory we’ve created in the previous command using the cd command, as shown below.

If the target directory is in another location, use the cd command with the path to it.

8) touch

The touch command is another way of creating files in Linux. However, it doesn’t let you add content to the created files, but it’s an excellent way of creating numerous files.

9) grep

When listing files and folders, you can use the grep command to filter the results. The grep command can be combined with different commands to achieve a desired filtered output. For this example, we’ve used it with the ls command to filter a specific file that matches the specified name. That way, we won’t have to list all the files and manually locate the target one.

10) sudo

In Linux, the sudo command gives you super user privileges. Some commands can only be executed when run as the administrator, and if you are not root, you can run the administrative commands using the sudo command. For instance, installing packages requires you to add sudo to the install command for it to execute.

For this example, we’ve used the whoami command to display the logged-in user. Next, we’ve used the sudo command with su to switch to root. Lastly, we’ve run the whoami command again to verify that we are now root and don’t need to include sudo when executing administrative tasks.

Be keen when running commands as root, as you have minimal room for reversal when you perform administrative tasks.

11) rm

When you have unwanted files, you can quickly remove them using the rm command. You can add the -v option to get a verbose output.

To remove a folder using the rm command, add the -r option. Otherwise, you will get an error hindering you from deleting the folder.

12) rmdir

Suppose you want to remove a folder without using the rm -r command. Use the rmdir and seamlessly delete the specified folder.

13) echo

The echo command lets you display text or output to the standard output. For the first example, we’ve echoed a given text to the standard output.

For this example, we’ve used echo to display the given text but redirected it to a new file created upon execution of the command.

14) cp

The cp command lets you copy a file or folder from the source to the destination. The example copies the names.txt file from the specified location to the current directory.

15) mv

You can also move the file or folder instead of copying it using the mv command. Specify the source for the file or folder and add the destination, and your file or folder will immediately get moved.

16) man

Every Linux command has a manual that explains how to use it. Access the manual by typing the man keyword followed by the command’s name.

Conclusion

This post has presented 16 Linux commands you must know to harness the power of the Linux command line. Hopefully, you now have a better understanding of using Linux to perform different activities with simple commands.

New to LinuxMeta? Get Started Now! 

Instantly Deploy Linux & Windows KVM VPS at a Cheap Price