Skip to main content
LPIC-1 Exam 101RH124

Managing and Monitoring Processes with top

centos7A simple way to monitor and manage processes from the command line of a Linux system is to use the command top (/bin/top). We will see how easy this is to use and how top amalgamates many smaller utilities into the single text interface

We can start top without any option or arguments as a standard user just using: top. This will display resource information at the top of the screen and details on running processes in the bottom of the screen.

The resource information at the top of the screen includes three elements and each element can be toggled on and off with their own hot-key.

  • Load Averages (use l to toggle on and off)
  • Tasks (use t to toggle on and off)
  • Memory (use m to toggle on and off)

The running processes in the main window are sorted by default on the CPU utilization field. We can change this by using f and then navigating to the field we want to sort on and use s to select and ESC to return to the main screen.

To leave  top we can use the q key.

To view a single process in top we could use:

top -p 2278 (or the required PID)

We can renice running processes by using the key r. Each process has a nice value from -20 to +19 that has an effect on the CPU priority for the process. the lower the nice value (going towards – values ) the the more CPU time is assigned. This can be done directly from the command line using the renice command but top simplifies this.