Monitoring system resources in Linux
In Linux, there are many tools available to monitor system resources and performance. In this tutorial, we’ll cover some of the most commonly used tools.
- top
top
is a command-line tool that displays real-time system statistics, including CPU usage, memory usage, and running processes. To launch top
, simply open a terminal and type top
. You’ll see a list of processes sorted by CPU usage, with additional information on memory usage and other system statistics.
- htop
htop
is a more advanced version of top
that provides additional features and a more user-friendly interface. To install htop
, use your distribution’s package manager. For example, on Ubuntu, you can install htop
using the following command:
sudo apt-get install htop
Once installed, you can launch htop
by typing htop
in a terminal. Like top
, htop
displays real-time system statistics, but with a more graphical interface and additional features like mouse support and process filtering.
- iotop
iotop
is a command-line tool that monitors I/O usage on your system, including disk and network I/O. To install iotop
, use your distribution’s package manager. For example, on Ubuntu, you can install iotop
using the following command:
sudo apt-get install iotop
Once installed, you can launch iotop
by typing sudo iotop
in a terminal. iotop
displays real-time I/O usage, with a list of processes sorted by I/O usage.
- nmon
nmon
is a command-line tool that provides a comprehensive view of system performance, including CPU usage, memory usage, network I/O, and more. To install nmon
, use your distribution’s package manager. For example, on Ubuntu, you can install nmon
using the following command:
sudo apt-get install nmon
Once installed, you can launch nmon
by typing sudo nmon
in a terminal. nmon
provides a graphical interface that displays real-time system statistics in a user-friendly format.
- sar
sar
is a command-line tool that collects and reports system performance data over time. To install sar
, use your distribution’s package manager. For example, on Ubuntu, you can install sar
using the following command:
sudo apt-get install sysstat
Once installed, you can use the sar
command to collect and report system performance data. For example, to collect CPU usage data every 10 seconds, use the following command:
sar -u 10
This will display a real-time report of CPU usage every 10 seconds. You can also use the -f
option to view historical data collected by sar
.
By using these tools, you can monitor system resources and performance on your Linux system, and identify potential bottlenecks and issues.