With the widespread use of Linux, it is imperative to understand the process of server running, as a beginner it is necessary to summarize their own technical documents, according to their own summary of the document to write the following description.
PS View Static Process information
You can use the man to see the usage parameters of PS The following are several commonly used,
A displays all process information for the current terminal
U output process information in a user-oriented format
x displays process information for the current user under all terminals
-e Displays all processes within the system
PS shows only the processes that are open by the current user
PID TTY Time CMD
1949 PTS/1 00:00:00 Bash
2279 PTS/1 00:00:00 PS
]# PS aux display all process information in the system
USER PID%cpu%MEM VSZ RSS TTY STAT START time COMMAND
Root 1 0.0 0.1 2072 620? Ss 16:07 0:01 init [3]
Root 2 0.0 0.0 0 0? s< 16:07 0:00 [migration/0]
Root 3 0.0 0.0 0 0? SN 16:07 0:00 [ksoftirqd/0]
Root 6 0.0 0.0 0 0? s< 16:07 0:00 [Khelper]
Root 7 0.0 0.0 0 0? s< 16:07 0:00 [Kthread]
Root 173 0.0 0.0 0 0? s< 16:07 0:00 [cqueue/0]
Root 176 0.0 0.0 0 0? s< 16:07 0:00 [KHUBD]
Root 178 0.0 0.0 0 0? s< 16:07 0:00 [Kseriod]
Root 241 0.0 0.0 0 0? S 16:07 0:01 [Pdflush]
Root 243 0.0 0.0 0 0? s< 16:07 0:00 [kswapd0]
Root 244 0.0 0.0 0 0? s< 16:07 0:00 [aio/0]
Root 496 0.0 0.0 0 0? s< 16:07 0:00 [Ata_aux]
Root 501 0.0 0.0 0 0? s< 16:07 0:00 [kstriped]
Root 510 0.0 0.0 0 0? s< 16:07 0:00 [KSNAPD]
Root 2087 0.1 2.2 31304 11408? Ss 19:58 0:00/usr/sbin/httpd
Root 2115 0.0 0.1 2528 640? S 19:59 0:00/usr/local/apache2/bin/rotatel
Root 2118 0.0 0.1 2528 640? S 19:59 0:00/usr/local/apache2/bin/rotatel
Apache 2119 0.0 1.2 31304 6380? S 19:59 0:00/usr/sbin/httpd
Note the contents of the representation shown above
User account name to start the process
PID ID number of the process in the system
Percentage of CPU used by%CPU
%MEM memory consumption percentage
The size of the virtual memory that the VSZ occupies
RSS takes up the size of physical memory
TTY the process runs at that terminal
Start time of the process
Time the process consumes CPU
The name of the command that commands the process to start
2 top Dynamic Display system process information
[email protected] ~]# Top
top-20:08:54 up 4:01, 5 users, Load average:0.07, 0.17, 0.45
tasks:141 Total, 1 running, 139 sleeping, 0 stopped, 1 zombie
Cpu (s): 6.1%us, 4.2%sy, 0.0%ni, 87.5%id, 1.7%wa, 0.0%hi, 0.6%si, 0.0%st
mem:515340k Total, 433076k used, 82264k free, 20548k buffers
swap:522072k Total, 84k used, 521988k free, 217348k cached
PID USER PR NI VIRT RES SHR S%cpu%MEM time+ COMMAND
1884 Root 0 100m 17m 10m S 1.5 3.6 0:05.93 gnome-terminal
241 Root 0 0 0 0 S 0.2 0.0 0:01.49 Pdflush
2491 Root 0 2336 1036 R 0.2 0.2 0:00.17 Top
2492 Xiaowang 0 10192 3304 2172 S 0.2 0.6 0:00.32 vim
3957 Root 0 41212 12m 8584 S 0.2 2.5 0:22.81 metacity
3961 Root 0 83120 14m 9.8m S 0.2 2.8 0:03.07 Gnome-panel
4035 Root 0 70804 15m 10m S 0.2 3.0 0:13.07 Wnck-applet
4637 Root 0 12044 1160 940 S 0.2 0.2 0:11.90 Scim-bridge
4638 Root 0 16672 2184 1420 S 0.2 0.4 0:08.75 gnome-screensav
1 Root 0 2072 620 532 S 0.0 0.1 0:01.42 Init
Note the content represented above is displayed
The first line is the task queue information, which is equivalent to the execution result of the same uptime command. The contents are as follows
Indicates the current system time system run time logon user average load
The second to third behavior process and CPU information.
tasks:141 total, number of processes 1 running running processes
139 Sleeping dormant Process number 0 stopped stop 1 zombie zombie process number
CPU (s): 6.1%us, CPU percentage used by SY kernel Space CPU percentage of processes that have changed priority within NI user process space
ID Idle CPU percent WA waits for the input output CPU time percentage
The last two behavior memory information.
The contents are as follows:
Mem:1 Total amount of physical memory used the total amount of physical memory that is used the total amount of free memory buffers used as the memory of the kernel cache
Total amount of used used in Swap:total swap area total free swap area total cached buffer swap area total.
Top command parameters
D: Change the update speed of the display, or press s in the chat command column (interactive command)
Q: There is no delay in the display speed, if the user has Superuser permissions, then top will be executed with the highest precedence
C: Toggle display mode, a total of two modes, one is to display the name of the execution file only, the other is to display the full path and name S: Cumulative mode, will be completed or disappeared sub-stroke (dead child process) CPU time accumulated
S: Safe mode, cancel conversational instruction, avoid potential crisis
I: Do not display any idle (idle) or useless (zombie) travel
N: The number of updates that will exit the top after completion
B: Batch mode, used with "n" parameter, can be used to output top results in the file
The 3 pgrep command can query the PID number of a particular process based on the specified process name, the user running the process, the terminal of the process, and many other properties
Pgrep-l mysqld
32597 Mysqld_safe
32647 mysqld
Pgrep-l-u view PID number of user running process
4 Pstree View Process Count
can display the process number structure of all users in the system without any parameters
[Email protected] ~]# Pstree
Init─┬─acpid
├─atd
├─AUDITD─┬─AUDISPD───{AUDISPD}
│└─{AUDITD}
├─automount───4[{automount}]
├─avahi-daemon───avahi-daemon
├─bonobo-activati───{bonobo-activati}
├─bt-applet
├─clock-applet
├─crond
├─cupsd
├─2[Dbus-daemon]
├─dbus-launch
├─eggcups
├─ESCD───{ESCD}
├─events/0
├─gam_server
├─gconfd-2
├─gnome-keyring-d
Pstree aux will list the PID user name and command information for the process
[Email protected] ~]# Pstree-aup
init,1
├─acpid,3198
├─atd,3544
├─auditd,2467
│├─audispd,2469
││└─{audispd},2480
│└─{auditd},2468
├─automount,3296
│├─{automount},3297
│├─{automount},3298
│├─{automount},3301
│└─{automount},3304
├─avahi-daemon,3575,avahi
│└─avahi-daemon,3576
├─gnome-terminal,1884
│├─bash,1949
│├─bash,2241
││└─su,4076 FJC
││└─bash,4077,fjc
││└─vim,4097 1.php
│├─bash,2295
││└─pstree,4366-aup
│├─bash,2494
│├─gnome-pty-helpe,1914
│└─{gnome-terminal},1916
├─gnome-vfs-daemo,3980
├─gpm,3465-m/dev/input/mice-t EXPS2
├─hald,3217,haldaemon
│└─hald-runner,3218,root
│├─hald-addon-acpi,3225,haldaemon
│├─hald-addon-keyb,3233,haldaemon
│└─hald-addon-stor,3242
├─hcid,3109
├─hidd,3267–server
├─hpiod,3318
├─httpd,2087
│├─httpd,2119,apache
│├─httpd,2120,apache
│├─httpd,2121,apache
│├─httpd,2122,apache
│├─httpd,2123,apache
│├─httpd,2124,apache
│├─httpd,2125,apache
│├─httpd,2126,apache
│├─rotatelogs,2115/home/xiaowang/logs/%y%m%d%h.error_log 720048
│├─rotatelogs,2116/home/xiaoli/logs/%y%m%d%h.error_log 7200 480
│├─rotatelogs,2117/home/xiaowang/logs/%y%m%d%h.access_log 72004
│└─rotatelogs,2118/home/xiaoli/logs/%y%m%d%h.access_log 7200480
View the number of processes used by a user structure information
Pstree-ap FJC
bash,4077
└─vim,4097 1.php
There are many parameters that can be found in man one by one.
How to view process status under Linux