The article directories
- 1. Dynamically monitor processes
- 2. Application examples
1. Dynamically monitor processes
- Introduction:
top
与ps
The commands are similar. Both are used to show the process being executed. The biggest difference between TOP and PS,Top can update running processes during execution. - The basic grammar
Top [option]Copy the code
- Options:
- The top of the default per
3s
Update once. Such as: every5s
Update once:
top -d 5
Copy the code
- Top illustration
- Zombie process: The process has died, but memory has not been freed.
- Interactive operation instructions:
top
The default value is each3s
Refresh a
- Sort by P (%CPU) (default sort) :
- Memory sort by M (%MEN) :
- Sort by N (PID) :
2. Application examples
- Example 1. Monitor a specific user, for example, listen
xdr
User, now create a session loginxdr
The user
top
: Enter this command and press Enter to view the running process.
u
: Then enter”u
“Press Enter, and then enter the user name
- Case 2: Terminating a specified process. For example, end the XDR user login
top
: Enter this command and press Enter to view the running process.
k
: Then enter”k
“Press Enter and enter the process you want to endID no.
- Case 3: Specify the timing of system status updates (every
10
Automatic update in seconds), the default is3
秒
top -d 10
Copy the code