Last week, I published part 1 of this five-part series entitled: Linux Commands frequently used by Linux Sysadmins. That first article scratched the surface of what I believe are 50 to 100 commands used often by Linux Sysadmins and power users. Also, see Part 3, Part 4, and Part 5.
Let’s jump into another set of commands and command-line tools often used for analysis, troubleshooting, and Linux system administration. Listed below are some of the commands I’ve used over the past week. In this and future series, I will group related commands together as much as possible and add a table of contents to interlink all five parts.
1. Command-line Linux system monitoring.
Very often, it’s useful to view Linux system performance. He’s a shortlist for quickly accessing system performance details via the command line.
uptime
– shows system uptime and load average.top
– shows an overall system view.vmstat
– shows system memory, processes, interrupts, paging, block I/O, and CPU info.htop
– interactive process viewer and manager.dstat
– view processes, memory, paging, I/O, CPU, etc., in real-time. All-in-one for vmstat, iostat, netstat, and ifstat.iftop
– network traffic viewer. Ex:iftop -i eth0
nethogs
– network traffic analyzer.iotop
– interactive I/O viewer. Get an overview of storage r/w activity.iostat
– for storage I/O statistics.netstat
– for network statistics.ss
– utility to investigate sockets.
Here are some related articles I’ve written in the past covering command-line system monitoring tools:
top
– Here’s how to customize it.atop
– For Linux server performance analysis.Glances
andnmon
– htop and top Alternatives:htop
– Quick Guide & Customization.bashtop
– the ‘cool’ top alternative.
2. ssh
– secure command-line access to remote Linux systems.
Other than my Homelab, most of my Sysadmin related work is performed remotely. With clients’ server locations in the Americas, Europe, Asia, and Australia. Access command line on a remote server; you can use the ssh
command.
The ssh
command provides secure encrypted connections between local and remote hosts. ssh
is used for terminal access, file transfers (sftp), and tunneling other applications.
ssh -i [key_file] [user]@[hostname/ip] -p [port]
-i
identity_file, selects a file from which the identity (private key) for public-key authentication is read.
-p
port, is used to select which port to connect to on the remote host.
For example:
ssh -i path/to/key_file root@ip_address -p 2222
SSH can also be run securely on a graphical desktop using terminal emulators such as Terminator.
Also, take a look at telnet
and scp
– Securely Copy Files Using SCP with examples.
In Part 3, we will take a look at using rsync
.
3. sudo
– execute commands with administrative privilege.
The sudo
(Super User DO) command in Linux is regularly used as a prefix to commands which only the superuser (root) has permission to run. If you are not logged in with the root user, you can use the sudo
command to preface a command in order to run that command with root privileges. For example:
$ sudo apt install terminator
Once you run a s