linux top command examples

  • Top command is very useful tool to see the system performance statistics like processes, memory, swap, load average etc.
  • Here we have covered all the aspects of the top command.

Examples:

1. “top” command for one iteration

$ top -n 1

2. kill process without exiting “top”

$ top
–> then press k
–> then enter PID

3. To renice a process

$ top
–> then press r

4. “top” for specific user

$ top -u santosh

5. “top” for specific process

$ top -p PID,PID…

6. To display the CPU’s

$ top
–> then press 1

7. Refreshing output of “top”

$ top
–> then press “spacebar”

(To change the output update frequency, press d in interactive mode, and enter the time in seconds as shown below.)

8. Highlight Running Processes in the Linux Top Command Output

$ top
–> then press z/b

9. Display Absolute Path of the Command and its Arguments

$ top
–> then press c

10. Executing Unix Top Command in Batch Mode

$ top -b -n 1

(Useful when you want to capture the output in txt format)

11. Split Top Output into Multiple Panels

$ top
–> then press A

12. Toggle Top Header to Increase Number of Processes Displayed

$ top
then
–>     Press l – to hide / show the load average. 1st header line.
–>     Press t – to hide / show the CPU states. 2nd and 3rd header line.
–>     Press m – to hide / show the memory information. 4th and 5th line.

13. To save top command configuration changes

$ top
–> then press W

Leave a Reply

Your email address will not be published. Required fields are marked *