The role of the top command
Used to view the resource usage of the process, such as you write a program, want to see how much it occupies the CPU, how much memory, whether the machine is overloaded, top can help you
Usage
Enter top directly, this is the screen will show some dynamic changes in the refresh period is 1s, if you want to change the refresh period, use the-D (delay) parameter, such as: top -d 3 indicates 3s refresh once
I am currently using Ulric account to log in, I just want to see Ulric start all the process of the situation: top -u ulric
I just want to see the situation of a certain number of PID corresponding processes:top -p pid1, pid2, pid3
The refresh process responds to a number of keystrokes, such as:
M Sort by memory footprint
P Sort by CPU consumption
T Sort by time+ occupancy
K prompts you to enter a PID, which will be killed after the input
U prompt you to enter a user name, for example, I input Ulric, will show only the ulric corresponding process situation
C Display command complete commands, click again, back to the original appearance
Q Exit Top
The role of each field
PID//Process Piduser //Process Owner PR //process priority, smaller priority executed NI //Nice value virt/// process occupied virtual memory RES//process occupied physical memory SHR// The process uses the shared memory s //process state, S for hibernation, R for Running;z, and N for the process with a negative value of%CPU//process-occupied CPU usage%mem // The amount of physical memory that the process consumes and the percentage of total memory time+ //The total CPU time that is consumed after the process is started, that is, the cumulative value of CPU usage command//process start name
More it interview questions please pay attention to public number: It_mianshiti
[One question per day] talk about the features and usage of the Linux top command