- Category : Server Administration
- Posted on : Nov 25, 2017
- Views : 582
- By : Zane P.
For the casual user of Windows, the Linux command line looks really intimidating and appears to be a complex and unfriendly interface that requires the knowledge of arcane commands.
In reality, the command line is immensely powerful and actually allows an experienced user to monitor, control and tune every single aspect of the system.
Even a minimal installation of CentOS comes with a rich selection of useful tools and many others can be installed from the standard repositories.
In this blog article, we will briefly discuss the top five tools that a CentOS administrator should master in order to maintain servers in top shape.
The command line is all about editing text files and there is no better tool than Vim for this purpose.
Vim is actually a very old program that can be traced back to the original vi developed for Unix systems in 1976. It preserves some archaic features but has been constantly improved over the years and can be personalized with many plugins and options.
The initial learning curve is notoriously steep and most Linux newbies have been trapped in Vim at the start of their journey, with no clue how to get out.
However, Vim can be incredibly useful once you learn some of its shortcuts and becomes much more than a simple text editor. You can configure it for example as a very fast coding tool.
For a quick introduction to Vim, run the command vimtutor and follow the interactive tutorial.
In all distributions from the RedHat family, yum serves as the package manager of choice. It is a powerful tool that handles the installation of new packages, as well as their update or removal.
Yum is available by default on all CentOS systems but the software selection in the initial repositories is quite poor. This reflects the RedHat philosophy of emphasizing security and stability, by only offering packages that have been thoroughly tested.
As a result, the official repos provide older software, several versions behind the latest one, for example php 5.4
System administrators usually configure other repositories in order to install and update newer packages.
One of the most popular is epel-release, which can be installed as a package and includes many useful tools. Other common choices are the remi or ius repositories for php and its associated extensions.
Most software developers also maintain dedicated repositories that provide the latest versions of their packages.
Netstat is very useful command line tool that shows network connections and statistics, as well as open ports and sockets.
Executing it with no arguments will display a lot of information, so you will have to learn how to control the output using flags.
System administrators typically use nestat to view the processes that listen on certain ports, here is an example of the flags used for this purpose and the result:
You can see for example that the sshd service with the PID 1029 listens on the default TCP port 22 and accepts connections from any external source.
This simple command that shows a list of files that are opened by various processes is a very powerful monitoring and debugging tool in the hands of an experienced CentOS system administrator.
Just like netstat, lsof displays a large amount of information that can be filtered using the appropriate syntax.
There are a lot of options and possible use cases for this command, here are three common examples and their output.
The –u flag displays the files opened by a specific user (in this case, grafana):
lsof –u grafana
By providing the full path of the file, lsof will show the processes that have opened it (for example, only the rsyslog daemon has used the main log file):
Another very common task is to list the files opened by a process, based on its PID. Here is the partial output of files opened by rsyslog, using the PID from the previous example:
lsof – p 829
Another tool used to inspect processes is top, which serves as a real-time monitoring tool from the command line.
Unlike the previous commands, top is very easy to understand and use, so learning its options is not really needed.
Just type top in the terminal and you’ll see a dynamic list of all active processes and threads that can be ordered based on various values, such as the CPU or memory usage.
It is a great troubleshooting tool on servers that experience heavy load and allows processes to be killed directly from its interface.
There are multiple ways to achieve the same task in CentOS and every system administrator has his own preferred tools, we have selected the ones in this article based on our subjective opinion.
Many other useful tools are available in the Linux world and a good sysadmin has to know how to work with an increasingly large number, we will describe some of them in future articles on our blog.
Subscribe Now10,000 successful online businessmen like to have our content directly delivered to their inbox. Subscribe to our newsletter!
Posted on : Apr 07
Posted on : Mar 19
Posted on : Feb 19
Posted on : Jan 27
- layer 7
- ddos mitigation
- server load
- seo vpn
- cheap vpn
- VPS Hosting
- Hosting Security
- Link Building
- Small Business
- SSD Hosting
- Dedicated Server
- Digital Marketing