5 min read May 10, 2017 at 2:29pm
cPanel is great for administering Linux Servers, especially if you do not have experience of using the command line. However, the top 5 most essential command line tools to control a Linux Server manually are not that hard to learn. The most basic functionalities of those programs can be learned quickly; this guide shows where you can find valuable information to help you master those skills with ease.
Secure Shell needs to be the first tool here. The reason is obvious: without SSH, you cannot perform a secure connection to your virtual private server. The most basic functionalities of OpenSSH are easy to master and use. Our knowledge base can give you an overview of how SSH works, and it also provides two traditional methods of authenticating the connection with virtual private servers.
Nevertheless, you do not have to limit yourself to the most basic functionalities of OpenSSH; there are a thousand different ways to use and configure it. You can easily find more advanced configurations and practical information in the following books:
Barret, Daniel J. Silverman, Richard. Byrnes, G. Robert. The Secure Shell: The Definitive Guide. 2nd Ed. Sebastopol, CA: O’Reilly, 2005.
Lucas, Michael W. SSH Mastery: OpenSSH, PuTTY, Tunnels and Keys. Self-published. Charleston: CreateSpace, 2012.
Could you imagine a handyman who does not know how to use an electric drill? In the same way, it is hard to image an *nix administrator who does not know how to use Vi. Vi or Vim (“Vi Improved”) are the default text editors on most modern Gnu/Linux distributions. Even if you are an Emacs user, it is still important to learn the basics of Vim.
In the Unix world, there’s a famous quote: “Everything is a file.” If this is true, you need a tool to edit those files without difficulties and without fancy graphical interfaces. With Vi, you can modify any text-only file on your system.
The first time you use Vi, it should look counterproductive. Richard Stallman would say, blasphemously, that using Vi is not a sin but a penance. However, after a short period learning Vi, you start noticing how powerful and productive this small and old-school text editor is.
This book is a good point to start learning Vim:
Robbins, Arnold. Hannah, Elbert. Lamb, Linda. Learning The Vi and Vim Editors. 7th Ed. Sebastopol, CA: O’Reilly, 2008.
There are some common errors that beginners tend to make when learning Vi, like using the arrow keys too much and overestimating the h, j, k, and l keys to move around. The reason why you must avoid using the arrow keys is evident. The h, j, k, and l keys, on the other hand, were not designed to change the position of the cursor, but rather to refine its location. Fortunately, Hard Mode is a plugin that disables all keys related to bad keyboard habits. The blog post “Habit breaking, habit making” from vimcast.org can help you to identify bad habits and understand Vim's advanced motion and search functionality.
3) Package Managers
To know how to add and remove packages from your system is one of the most basic tasks to start administering a GNU/Linux distribution. Many courses about Linux have the package management as their first topic. The reason is clear: distributions are built upon packages. Even the kernel can be installed using package managers in most of the modern distributions.
RPM and DPKG (and its front end YUM and APT) are the predominant package managers. Luckily, there are no secrets of using tools like
apt. Both the Red Hat documentation and Debian official website provide useful instructions on how to perform yum and apt essential usages. The Packman/Rosetta page in the Arch Linux wiki shows “the correspondence of package management commands among some of the most popular Linux distributions.”
Once you have your operating system installed, it is time to think about security. Sudo, or more precisely its configuration file (
/etc/sudoers), is one of the first things to configure. This program allows system administrators to “delegate authority to give certain users (or groups of users) the ability to run some (or all) commands as root or another user while providing an audit trail of the commands and their arguments.”
Another benefit of
sudo is that users who received superuser privileges do not need to share the password of the
root user. It also prevents you from typing commands as a superuser when privileges are not required.
In general, system administrators tend to use only the base minimum functionalities supported by the
sudo package. The internet is not always the best place to look for information about
sudo; there are too many blog posts and articles teaching you to use
sudo in the wrong way, which makes the packages lose their importance.
The book shown next has, nevertheless, good examples of how to configure and use all the power of
sudo in your favor.
Lucas, Michael W. Sudo Mastery: User Access Control for Real People. Self-published. Charleston: CreateSpace, 2013.
Red Hat documentation on Security can bring extra strategies to your defensive arsenal too.
5) *SH and Python Scripting
Finally, let’s talk about shell scripts. Of course, you can think about shell scripting not only as a tool but also as an important skill. Shell scripts are nothing more than a collection of commands written in the order of execution. This simple tool is handy to automate Linux system maintenance tasks. You can even create a shell script to react against intruders automatically. When combined with
systemd.timer and other job schedulers, shell scripts can be used to automate all system-related routines; as a result, your VPS can send you an e-mail with the output of those tasks specifying whether or not they were completed successfully. That is the power of a shebang.
On the other hand, if the task you want to perform involves a lot of different but related parts, perhaps it is time to consider Python as a scripting language for complex managerial duties. Almost all Linux distribution include a Python interpreter. Python holds modules for operating system-dependent functionality that can be integrated easily into scripts.
If you are entirely new to Shell and Python scripting, you should consider reading the following books:
Michael, Randal K. Mastering UNIX Shell Scripting. 2nd Ed. Indianapolis, IN: Wiley, 2008.
Johnson, Chris. Varma, Jayant. Pro Bash Programming. New York, NY: Apress, 2015.
Sweigart, Albert. Automate the Boring Stuff with Python: Practical Programming for Total Beginners. San Francisco, CA: No Starch Press, 2015.
written by Diego Aurino.