How to use the Linux system top command

  

In the Linux system, the top command can be used to monitor the status of the process, or to modify the priority sequence of the process. This article will teach you how to use the top command in the Linux system, let's take a look.

1, the main option

-d: seconds after contact, status update seconds, 5 seconds default

-b: a batch manner Run top, usually redirect the output of the top to the file using redirection

-n: use -b to use, run top several times

-p: specify the PID of the observed process
>

2. Key commands that can be used during top execution:

? : Display in top can enter key command

P: Sort by CPU utilization;

M: Sort by memory utilization;

N: PID sorting!

T: CPU time accumulation (TIME+) sorting used by this process.

k: Give a PID a signal

r: Re-specify a PID with a nice value.

q: Exit top.

3, example

$top -d 2 //Update the running status every 2 seconds

$top -b -n 2 》 ~/tmp/top.txt //Export the status information of 2 runs to the file

$top -d 2 -p 1425 //Update the running status information of the specified process every 2 seconds

The above is Linux The use of the top command is all about, so the function of the top command is similar to the function of the process manager in Microsoft system. You can use the top command to monitor the performance of Linux. For details, see "How to Use the Top Command to Monitor Linux System Performance." 》

Copyright © Windows knowledge All Rights Reserved