Interacting with the `top`
23 gennaio 2008, 14:26 Shell , System , Tips & Tricks January 23, 2008, 14:26Working on UNIX / Linux tool to show the status of key processes is the `top`. Launched from the command line, top produces an output divided into two basic areas: the head shows general information on the system, while along the entire area below lists the processes that consume the most CPU.
In the first area provides the following information:
- current server time
- uptime of the servers (uptime)
- number of users logged
- average load of the system every minute, every 5 minutes and every 15 minutes
There are also information about processes, processor, memory and swap. There you must always ascertain that there are no zombie processes (that reduce the performance of the machine) and that the swap used either nothing or very low, otherwise means that the server is at fault of RAM.
The second area is divided into columns, which show respectively:
- the process ID (PID)
- user owning the process (USER)
- process priority (PR)
- nice value (NI)
- processor usage (% CPU)
- Memory usage (% MEM)
- process state (S)
- command used to start the process (COMMAND)
The program `top` takes a series of interactive commands, which can be launched by pressing a certain key. For example:
- k + [pid of the process] = ends the process.
- + r [pid of the process] = change the nice value of a process, ie its priorities in a range from -20 (highest priority) to 19 (lowest priority). In other words, giving a nice value less than the current execution improves the performance of the process.
- f = allows you to add or remove some fields in the process table.
- s = allows you to change the refresh time, ie the time between an update and the other values shown.
- = q to exit the program `top`.
For more detailed information consult the man page of the `top` running the command `man top`














