1. Role
The top command is used to display the program process in progress, and the permissions are all users.
2. Format
Top [-] [D delay] [Q] [C] [s] [s] [i] [n]
3. Main parameters
D: Specifies the interval of the update, in seconds.
Q: There are no delayed updates. If the user has a superuser, the top command will be executed with the highest precedence.
C: Displays the full path and name of the process.
S: Cumulative mode, which accumulates the CPU time of a child stroke that has completed or disappeared.
S: Safe mode.
I: Do not display any idle (idle) or useless (Zombie) travel.
N: Displays the number of updates and exits top when finished.
4. Description
The top command is a major command of Linux system Management, which gives you a lot of information. Here we illustrate the information it gives in the context of the diagram.
Display of the top command (figure)
The first line represents the current time, the system run time, the current number of system logons, the 1/5/10 minute system average load (generally, this load value should not be more than 1, unless your system is busy.) If it lasts above 5, then ..... Take a closer look at how the program is affecting the overall system! )。
The second line shows all processes started, currently running, suspended (sleeping), and useless (Zombie). (The comparison needs to be noted is the last zombie that value, if not 0, hey!) Take a good look at the end of the process and become a corpse, right? (Stop mode: The sleep process should be different, sleep will actively abandon the CPU, and stop is passively discard the CPU, example of single-step tracking, Stop (pause) process is unable to return to the running state)
The third line shows the current CPU usage, including the US user space consumption CPU percentage, the SY core space consumption cpu percentage, the NI user process space has changed the priority of the process occupied CPU percentage (interrupt processing Occupation), the ID idle CPU percentage, WA Waiting for the input and output of the CPU time percentage, hi,si,st the meaning of the directory is unclear:)
Row four shows the use of physical memory, including total available memory, used memory, free memory, and memory consumed by the buffer.
The five rows show the swap partition usage, including the total swap partition, used, idle, and the size used for the cache.
Line six shows the most items, and the detailed explanations are listed below.
PID (Process ID): Process identification Number (ID per process)
User: The username of the process owner (the consumer of which this process belongs)
PR: The priority level of the process (shorthand for priority, the order of precedence of the program, the smaller the sooner executed)
NI: The priority value of the process (the shorthand for Nice, which is related to the precedence, is also smaller and is executed sooner)
VIRT: The virtual memory value that the process occupies.
RES: The physical memory value that the process occupies.
SHR: Shared memory value used by the process.
S: The state of the process, where s indicates hibernation, R is running, Z represents a zombie state, and N indicates that the process precedence value is negative.
%CPU: The CPU usage that the process consumes.
%MEM: The percentage of physical memory and total memory that the process occupies.
Time+: Total CPU time taken up after the process is started (cumulative CPU usage time)
Command: The start command name of the process startup, and if this line does not appear, the process will have a full command line.
While the top command is in use, you can also use some interactive commands to complete the functionality of other parameters. These commands are started by using shortcut keys.
Space: Refresh now.
P: Sort According to CPU usage size.
T: Sort by time, cumulative time.
Q: Exit the top command.
M: Toggles display memory information.
T: Toggles display of process and CPU status information.
C: Toggle display command name and full command line.
M: Sorts according to the size of the memory used.
W: Writes the current settings to the ~/.TOPRC file. This is the recommended way to write top configuration files.
As you can see, the top command is a very powerful tool for monitoring systems and is especially important for system administrators. However, its disadvantage is that it consumes a lot of system resources.
5. Application examples
You can use the top command to monitor a specified user, and the default is to monitor processes for all users. If you want to see the situation of the specified user, press the "U" key in the terminal, and then enter the user name, the system will switch to the specified user's process run interface, as shown in Figure 2.
A. Role
The free command is used to display memory usage, and the use of permissions is for all users.
B. Format
free [-b|-k|-m] [-O] [-s delay] [-t] [-v]
C. Main parameters
-b-k-M: Displays memory usage in bytes (KB, MB), respectively.
-S delay: Displays the number of seconds per second to show memory usage.
-T: Displays the memory sum column.
-O: Do not display buffer throttling columns.
D. Application examples
The free command is the primary command used to view memory usage. Compared to the top command, it has the advantage of being simple to use and consuming very little system resources. With the-s parameter, you can use the free command to continuously monitor how much memory is in use, which can be used as a handy real-time monitor.
#free-b-S5
With this command, the terminal continuously reports memory usage (in bytes), updated every 5 seconds.
Article Source: http://www.centoscn.com/CentOS/help/2013/0725/599.html
CentOS Top command detail and exit top command-use the P key and the free command