When it comes to working with
1. The htop
command – Interactive Process Manager
When I think of common linux commands for system monitoring htop
is the one that comes to mind first. htop
is an interactive process management tool for the Linux system. Think of this as the task manager of the terminal. I absolutely htop
top
but provides a larger set of functions for normal day users.
htop
Mac:brew install htop
Ubuntu or debian: sudo apt-get install htop
REHL, Fedora or Centos: sudo yum install htop
At a glance, htop
shows you the current CPU utilisation per core, system load over the last 15 mins, current memory utilisation and a list of all the running processes sorted by their CPU utilisation.
Here is the visual representation of htop [courtesy of Codeahoy.com]

htop
Command Top Section Explained
htop
Command bottom Section The colors in which the usage bars display the usage signify different things. You can quickly look up the htop
help by just hitting the F1
key on your system.

htop
command help, press F1
key.2. The top
command
The top
command displays and periodically updates sorted information about the running processes on a system. This is similar to the htop
command but is relatively difficult to use.

free
command.top
Command Examples:
# Running the process monitor
top
# Show processes by user ’nick’
top -u nick
top
Command Shortcuts:
h
Display Help q
Quit `top` M
Sort by Memory utilisation R
Process Sort by PID P
Sort by CPU utilisation k
Kill a process, press `k` then enter the PID to kill the process m
Hide/show memory usage bar r
Renice a process, scroll to the process and hit `r` key and enter renice value to renice a process. renice
means altering the scheduling priority of the running process.c
Show full path of the executables. w
To save the modified configuration permanently.
3. The ps
command – Process Status
ps
stands for process status, this command is used to view a snapshot of the currently running processes in any linux based system. This process status viewer utility comes preinstalled on all the flavours and distributions of linux. All things considered, this is by far one of the top used linux commands. In more than half the cases you’ll be using this command to find the PID of a wild running process (to kill obviously).
The ps
command provides a huge range of options that can be used to filter out the processes. In this list, we’re not covering them all. Although, if you’re interested you can always take a look at the manual page.
ps
Command Examples:
# Without any options, `ps` command returns all the processes of the current shell/session.
ps
# Display all the running processes, different variations for different distributions.
ps aux # BSD format
ps -A # Generic linux
ps -e # Another generic format
# List all the running processes in full format.
ps -ef
# List all the processes by the current user.
ps -x
# List all the processes running with the user ‘root’.
ps -u root
# List all the processes of a certain group (‘www-data’).f -full
,G - group
ps -fG www-data
# Display a process tree showing how the processes are linked to each other. Uh.. A forest of sorts.
ps -e --forest
# Display the forest thingy for just one process.
ps -f --forest -C nginx
# Filter out a process with name out of the list of all processes.
ps -ef | grep nginx
4. The free
command – Common Linux Commands
free
command displays the amount of free physical memory. In other words, free
displays the amount of RAM available in your linux system. In addition, it also shows the amount of memory being used currently and information about the swap memory. You can also check the memory buffers used by the kernel in linux using the free
command.
`free` command examples:
# Without any command line options,free
displays the total, used and free amounts of memory in KB.
free
# Display usage in Bytes.
free -b
# Display size in MBs.
free -m
# Display memory usage in GBs.
free -g
# Update the result every 5 seconds.
free -s 5
# Show high and low usage stats.
free -l
5. The df
command
The df
utility is used for checking the disk space utilisation in any linux system. This is another very important command in common linux commands. It stands for ‘Disk Filesystem’. df
at any instance shows the summary of total used and available space on the devices available in the system. For instance, if you want to check the amount of space left on your physical drive, you can just fire up a terminal and type df -h
. The df
utility will output in a human readable format, the amount of space used and the amount of space available on all the physical drives. In other words, if -h
option is supplied, it’ll convert the output to KB, MB, GB automatically, depending on the actual number.
df
Command Examples:
# Running without options, output will be in Bytes.
df
# Show all the mounted devices as well (external drives, dummy file systems can be checked using this option).
df -a
# Display the output in a human readable format
df -h
# Display the sizes in Giga Bytes.
df -g
# Display the type/format of the devices as well.
df -T
6. The nethogs
utility – Monitor Process Bandwidth in Linux
nethogs
is an open source tool that helps you monitor network bandwidth usage per program. Moreover it groups bandwidth usage on per process basis. In other words, if there are 10 sub-processes for Chrome, it’ll group and output the total bandwidth used by Chrome, per second. nethogs
updates in real time, so you can use it to monitor the system in real time. For instance, this utility can be used to find malware, the processes which are constantly uploading something off of your system to the web. Simply run nethogs
and monitor it for a while until you see an unfamiliar process in the list, you’ve got your culprit. To put it differently, you can find the processes that have been sucking on the internet bandwidth using this command. This is not a very commonly used linux command, but I feel it’s worth mentioning.nethogs
does not come pre-installed on linux distributions.
Installation:
Ubuntu / debiansudo apt-get install nethogs
RHEL, CentOS and Fedorasudo yum install nethogs
Mac:brew install nethogs

nethogs
previewnethogs
Examples:
# Refresh every 4 seconds.
nethogs -d 4
# Show stats for the wifi adapter (device name must be checked first usingifconfig
).
nethogs wlan0
# Show stats for ethernet network adapter, with 10 second refresh.
nethogs -d 10 eth0
This list of common linux commands for system monitoring will help you in monitoring any linux system or a remote server in 90% of cases. But sometimes you’ll require more specific tools to debug an issue. In a multi-server environment, where a server has an increased latency or is not responding at all – just logging into it via ssh
and running htop
will most likely tell you about its health.