2.3. Built-in Command-Line Tools
Red Hat Enterprise Linux 7 provides several tools that can be used to monitor your system from the command line, allowing you to monitor your system outside run level 5. This chapter discusses each tool briefly and provides links to further information about where each tool should be used, and how to use them.
2.3.1. top
The top tool, provided by the procps-ng package, gives a dynamic view of the processes in a running system. It can display a variety of information, including a system summary and a list of tasks currently being managed by the Linux kernel. It also has a limited ability to manipulate processes, and to make configuration changes persistent across system restarts.
By default, the processes displayed are ordered according to the percentage of CPU usage, so that you can easily see the processes consuming the most resources. Both the information top displays and its operation are highly configurable to allow you to concentrate on different usage statistics as required.
For detailed information about using top, see the man page:
$ man top
2.3.2. ps
The ps tool, provided by the procps-ng package, takes a snapshot of a select group of active processes. By default, the group examined is limited to processes that are owned by the current user and associated with the terminal in which ps is run.
ps can provide more detailed information about processes than top, but by default it provides a single snapshot of this data, ordered by process identifier.
For detailed information about using ps, see the man page:
$ man ps
2.3.3. Virtual Memory Statistics (vmstat)
The Virtual Memory Statistics tool, vmstat, provides instant reports on your system's processes, memory, paging, block input/output, interrupts, and CPU activity. Vmstat lets you set a sampling interval so that you can observe system activity in near-real time.
vmstat is provided by the procps-ng package. For detailed information about using vmstat, see the man page:
$ man vmstat
2.3.4. System Activity Reporter (sar)
The System Activity Reporter, sar, collects and reports information about system activity that has occurred so far on the current day. The default output displays the current day's CPU usage at 10 minute intervals from the beginning of the day (00:00:00 according to your system clock).
You can also use the
-i
option to set the interval time in seconds, for example, sar -i 60
tells sar to check CPU usage every minute.
sar is a useful alternative to manually creating periodic reports on system activity with top. It is provided by the sysstat package. For detailed information about using sar, see the man page:
$ man sar