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.
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.
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.
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
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
The 'cat' command in Linux can be used to show the contents of files:
root@server [~]# cat readme.txt
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
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
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.
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!