10 powerful command lines for Linux that will make you an expert

Back to the overview
10 powerful command lines for Linux that will make you an expert
7 minute read

Although Linux distributions differ in many ways, there are some command lines tools that are common across all of them. In this article, we'll look at how to use the power of these basic Linux commands to better control your system.

What is Linux?

Linux is the world's most popular open source platform, with a vast range of distributions to select from. The source code of Linux can be viewed, modified, and distributed by anybody because it was created as a free, open source operating system. This has brought together a vast group of dedicated developers that are constantly contributing to the Linux environment. The result is a stable platform that server administrators can use extensively.

 

Why would you pick Linux?

Linux is an open-source operating system. When you build your VPS, you first choose resources (RAM and CPU) and then select a desired operating system. That can be Linux, but also Windows, FreeBSD, and OpenBSD, for example.

While no operating system is 100% secure, Linux scores better than Windows in terms of security. There is worldwide support of programmers. In most cases, vulnerabilities are solved the same day with a security patch. With Windows you are dependent on the responsiveness of the company.

Linux has a modular structure. This means that the core of the operating system (kernel) is kept small and lightweight and additional components such as the graphical interface are built on top of it. As a result, Linux can be fine-tuned to the objectives and capabilities of the device.

Would you like to know more about how to put together your own VPS at Tilaa? Make sure to have a look at our configurator!

 

10 powerful command lines for Linux 

When using a Linux distribution, the command lines below will surely come in handy.

 

1. head

The 'head' command outputs the first section of files passed over standard input. It outputs the findings to the standard output. Head delivers the first 10 lines of each file it is given by default.

head head-tails.txt
1. Tilaa1
2. Tilaa2
3. Tilaa3
4. Tilaa4
5. Tilaa5
6. Tilaa6
7. Tilaa7
8. Tilaa8
9. Tilaa9
10. Tilaa10

 

2. Tail

The 'tail' command is the opposite of the head command. It prints the last N bytes of data from the supplied input. Tail displays the last 10 lines of the given files by default. Data from each file is preceded by its file name if more than one filename is given.

tail head-tails.txt
11. Tilaa11
12. Tilaa12
13. Tilaa13
14. Tilaa14
15. Tilaa15
16. Tilaa16
17. Tilaa17
18. Tilaa18
19. Tilaa19
20. Tilaa20

 

3. mkdir

The command ‘mkdir' in Linux means ‘make directory.' You can use the code below to create new folders:

root@server [~]# mkdir foldername

 

4. free -m

With 'free -m' you can see the total, used , free & cached memory of your server. For example:

root@server [~]# free -m

 

5. cp

With the command line 'cp', you can copy a file. For example:

root@server [~]# cp file /folder/folder/file

 

6. Reboot & shutdown

If you want to restart your Linux VPS server, type:

root@server [~]# reboot

 

To shut down the server, go for:

root@server [~]# shutdown

 

7. cat

The 'cat' command in Linux can be used to show the contents of files:

root@server [~]# cat readme.txt

 

8. df

The ‘df’ command line will give you a lot of information about your server’s disk space usage. It stands for ‘disk filesystem'. Many issues arise from when a disk drive becomes full and files can’t be written to it any longer. With 'df' you can check it. If the percentage reaches 98 to 100, there are good indications of a problem or potential problem.

root@server [~]# df 

 

Having a hard time reading the numbers? Simply add '-h' for the human (which explains the h) readable version. 

root@server:~$ df -h
Filesystem Size Used Avail Use% Mounted on
tmpfs 198M 1.1M 197M 1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv 30G 4.7G 24G 17% /
tmpfs 987M 0 987M 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 4.0M 0 4.0M 0% /sys/fs/cgroup
/dev/sda2 976M 129M 780M 15% /boot
/dev/sda1 511M 5.3M 506M 2% /boot/efi
tmpfs 198M 4.0K 198M 1% /run/user/1000

 

9. grep

The command line 'grep' searches a file for a string of characters. A regular expression is the term for the text search pattern. It publishes the line with the result when it finds a match.

cat head-tails.txt | grep Tilaa
1. Tilaa1
2. Tilaa2
3. Tilaa3
4. Tilaa4
5. Tilaa5
6. Tilaa6
7. Tilaa7
8. Tilaa8
9. Tilaa9
10. Tilaa10
11. Tilaa11
12. Tilaa12
13. Tilaa13
14. Tilaa14
15. Tilaa15
16. Tilaa16
17. Tilaa17
18. Tilaa18
19. Tilaa19
20. Tilaa20

 

10. man 

Last, but not least, in Linux, the 'man' command displays the user manual for any command that may be executed on the terminal. It provides a detailed view of the command which includes name, synopsis, description, options, exit status, return values, errors, files, versions, examples, authors and see also.

man grep

 

We hope that these 10 command lines help you take the next step in learning how to take control of your Linux VPS. Want to know about technical subjects such as these? Make sure to check out our Knowledge Base!

Share this article
Back to the overview
More like this