Looking for the Best Command Line Tools to Monitor Linux Performance, then here is a curated list of best command line based tools to monitor performance of your Linux System.
Linux is an open-source Unix-like operating system based on the Linux kernel. Linux was originally developed for desktop computers based on the Intel x86 architecture, although Linux is used by only around 2.3 percent of desktop computers, almost all of the web servers operating systems are Linux based. That means that most of the web applications and websites that run on the server use Linux as their operating system.
So the Network and System Administrators of these servers must ensure the reliability, and availability of the hosted web applications, websites and the underlying Linux Operating system on which these applications run.
In this guide we are going to give the list of best command line tools to monitor linux performance.
Top (table of processes) is a command line tool which shows information about the processes currently using the CPU. The top also displays the memory used by each process and also shows the used and available memory.
By default, Top displays the top 30 processes (which can be changed by specifying the number while executing the command) on the system and periodically updates this information. Top also shows the PID (process ID) of each process, you can use that PID to kill the process if that process is consuming a lot of system resources.
Top can be installed using the following command:
sudo apt install top
Htop is another popular system-monitor process-viewer and process-manager. Just like top, htop shows a list of processes running on a computer. Htop provides a list of all the processes running on the computer instead of displaying only the top 30 processes that Top shows.
Htop uses color and gives visual information about processor, swap and memory status. Htop also gives you the option to kill the process. Simply select the process and press F9 to send a kill command to end the process. To exit from the Htop simply press F10 or press Ctrl+C.
Htop can be installed using the following command:
sudo apt install htop
Tcpdump is a data-network packet analyzer and gives information to the user about the packets being transmitted or received over a network to which the computer is attached.
Tcpdump can read the packets going through the network interface card. Tcpdump not only captures packets over network interface cards, but can be used to read bluetooth packets, and raw usb packets.
However, tcpdump requires root privileges in order to work properly, so if you are going to use Tcpdump make sure you have necessary root privileges available on your system.
Tcpdump can be installed using the following command:
sudo apt install tcpdump
Vmstat is a system monitoring tool that displays information about the memory, processes, interrupts, paging and block I/O. It gives you detailed information about how much swap memory is being used, how many I/O operations are in process and also tells you about the CPU usage. Vmstat comes installed in Linux distributions.
Netstat is another popular command line tool to monitor Linux Performance. Netstat displays information about the network connections, routing tables, interface statistics. Netstat can be used to determine the amount of traffic on the network and can be used to troubleshoot network issues.
Netstat provides statistics about the protocol being used, IP address of the applications and the port being used, IP address and the port number of the remote computer to which the socket is connected and also the state of the TCP connection. Netstat also comes pre-installed in Linux distributions.
IOTOP is a command line utility that is used to monitor disk IO usage. It shows disk read and write speed of different tasks. Iotop is popular among Network and System Administrators to check the disk's read and write performance.
Iotop can be installed by running the following command in the terminal.
sudo apt install iotop
Lsof shows the list of all open files and the processes that opened them. Lsof shows the identification number of the process (PID) that has opened the file, command the process is executing, the owner of the process, the file's device numbers, the file's size or offset, and the name of the file system containing the file.
Lsof comes pre-installed in almost all Linux distributions.
If you have a system that is used by multiple users then you can use Psaact or Acct to monitor users activity. The Psacct or Acct runs in the background and collects accounting information about the users like how long the user was logged in, how many resources were used by each user and what processes were running.
Psacct or Acct can be installed using the following command:
sudo apt install acct
After installation the service needs to be started manually by running the following command in the terminal:
sudo service acct start
Iostat is another popular command line tool that is used to monitor storage devices performance, including local disks, or remote disks accessed over network file systems such as NFS.
Iostat can be installed using the following command:
sudo apt install sysstat
NetHogs is another popular utility to monitor network performance. NetHogs shows you per process network bandwidth so you can better identify the process that is causing high network bandwidth usage.
NetHogs give you information about the Process ID (PID) along with the user that invoked that process and the network interface being used by the process.
Final Words: Linux Performance Monitoring Tools
Although there are a lot of compex tools used by System and Network Administrators to monitor Linux performance. The above listed tools are some of the basic most widely used command line tools used to monitor Linux performance.
For a beginner it requires a little bit of learning before you can get used to these tools and make sense out of the information provided by these tools. So go ahead and give these tools a try and tell us what you think.
If you liked the article, consider following us on Twitter to get the latest tech news and updates.