The Top 20 Linux Commands

For those who use Linux, the terminal is a fundamental tool. With it, you can configure various packages, update the system, edit files, and even access other systems remotely.

For experienced Linux lovers and IT professionals, the ability to configure any service using the terminal becomes advantageous as it speeds up the process, allowing the use of scripts and plugins to easily perform tedious tasks.

Although this command list is intended for Linux, most of them can be used in other operating systems, such as macOS and other BSD-based systems.

1. CD

The cd command is used to navigate between directories in the system. Its basic structure is:

Linux Bash
cd /path/to/directory

You can use ~ to navigate to the user’s default directory:

Linux Bash
cd ~

You can use to navigate to the directory above the current one:

Linux Bash
cd ...

2. PWD

This command returns the path to the current directory.

3. LS

This command lists the files and folders in the current directory.

4. CP

This command copies files. Its basic structure is:

Linux Bash
cp /path/to/source /path/to/destination

If you need to copy entire directories, you need to use the -r (recursive) argument:

Linux Bash
cp -r /source/directory /destination/directory

5. MV

This command moves files. Its basic structure is:

Linux Bash
mv /path/to/source /path/to/destination

If you need to move entire directories, you need to use the -r (recursive) argument:

Linux Bash
mv -r /source/directory /destination/directory

6. RM

This command removes files. Its basic structure is:

Linux Bash
rm /path/to/file

If you need to remove entire directories, you need to use the -r (recursive) argument:

Linux Bash
rm -r /path/to/directory

7. MKDIR

This command creates directories. Its basic structure is:

Linux Bash
mkdir directoryName

8. RMDIR

This command removes directories. Its basic structure is:

Linux Bash
rmdir /path/to/directory

Please note that this command, unlike rm -r, can only remove empty directories by default.

9. CLEAR

Clears the terminal screen. You can also do this with the CTRL+L shortcut.

10. MAN

Opens the manual for the desired command. It is very useful when you want to understand what each argument of a command does. In general, it provides more detailed information than the command’s help argument (-h or –help). Its structure is:

Linux Bash
man desiredCommand

To exit the manual, simply press the q key.

11. WHO

Lists the logged-in users, the interface they are using, and the time they logged in.

12. UPTIME

Shows how long the machine has been logged in and provides additional information. It is a very useful command on servers when you need to know if there has been a power outage or if the server has been restarted.

13. SUDO

Allows a user to execute a command as a superuser (root). For this, the user must be part of the sudo group. Its basic structure is:

Linux Bash
sudo desiredCommand

14. SU

Allows you to log into the system as another user. Its basic structure is:

Linux Bash
su username

15. GREP

The grep command, by default, returns only the lines of a command with the searched keyword. It should be used in conjunction with a pipe (|), like this:

Linux Bash
commandToBeExecuted | grep desiredWord

16. HISTORY

Displays the last executed commands.

17. EXIT

Logs out of the session.

18. TOUCH

Creates a file. Its basic structure is:

Linux Bash
touch filename

19. CAT

Displays the contents of a file. Its basic structure is:

Linux Bash
cat filename

20. TAIL

Returns the last lines of a file. It is very useful for reading log files, for example. Its basic structure is:

Linux Bash
tail filename

If you want to specify the number of lines to be returned, you need to use the -n argument followed by the number of lines:

Linux Bash
tail -n numberOfLines filename

Fale conosco!

Escolha como deseja entrar em contato com a Vertexa.

Entraremos em contato!

Preencha com os seus dados para entrarmos em contato com você.

Obrigado 😊

Informações enviadas!

Em breve entraremos em contato contigo via e-mail.

Choose your region

South America 🇧🇷 Brasil