Analysis: Using the PS command
# PS-EF Show All Processes
# Ps-eo COMM,PCPU shows the size of the CPU occupied by all commands
E Show all Processes, O specify the name of the command
# Ps-eo Comm,pmem shows the size of mem occupied by all commands
PS Tool identifies 5 status codes for the process:
D non-interruptible uninterruptible sleep (usually IO)
R run runnable (on run queue)
S Interrupt Sleeping
T stop traced or stopped
Z Zombie a defunct ("zombie") process
[[email protected] ~]# ps -efuid pid ppid c stime tty time CMDroot 1 0 0 Jul02 ? 00:00:06 init [5] root 2 1 0 jul02 ? 00:00:00 [migration /0]root 3 1 0 Jul02 ? 00:00:00 [ksoftirqd/0]root 4 1 0 jul02 ? 00:00:00 [watchdog/0]root 5 1 0 jul02 ? 00:00:00 [migration/1]root 6 1 0 jul02 ? 00:00:00 [ksoftirqd/1]root 7 1 0 jul02 ? 00:00:00 [watchdog/1]root 8 1 0 Jul02 ? 00:00:00 [migration/2]root 9 1 0 jul02 ? 00:00:00  [KSOFTIRQD/2]
-E: Display the environment after the command executes
-F: Full display output
1) Process User ID (UID)
2) Process ID (PID)
3) Parent Process ID (PPID)
4) CPU scheduling situation (C)
5) process start time (stime)
6) Process Total CPU time
Example: List all the programs that are currently in memory
[[email protected] test6]# ps auxuser pid % Cpu %mem vsz rss tty stat start time commandroot 1 0.0 0.0 10368 676 ? Ss Nov02 0:00 init [3] root 2 0.0 0.0 0 0 ? s< nov02 0:01 [migration/0]root 3 0.0 0.0 0 0 ? SN Nov02 0:00 [ksoftirqd/0]root 4 0.0 0.0 0 0 ? S< Nov02 0:01 [migration/1]root 5 0.0 0.0 0 0 ? SN Nov02 0:00 [ksoftirqd/1]root 6 0.0 0.0 0 0 ? S< Nov02 29:57&nbsP [events/0]root 7 0.0 0.0 0 0 ? S< Nov02 0:00 [events/1]root 8 0.0 0.0 0 0 ? S< Nov02 0:00 [khelper]root 49 0.0 0.0 0 0 ? S< Nov02 0:00 [kthread]root 54 0.0 0.0 0 0 ?&nBsp; s< nov02 0:00 [kblockd /0]root 55 0.0 0.0 0 0 ? S< Nov02 0:00 [kblockd/1]root 56 0.0 0.0 0 0 ? s< nov02 0:00 [kacpid] ... Omit partial results
Description
User: The process belongs to the user account
PID: The number of the process
%cpu: Percentage of CPU resources that the process uses
%MEM: Percentage of physical memory occupied by this process
VSZ: The amount of virtual memory that the process uses (Kbytes)
RSS: The amount of fixed memory that the process occupies (Kbytes)
TTY: The process is operating on that terminal, if it is not related to the terminal, then display?, in addition, TTY1-TTY6 is the machine above the login program, if it is pts/0 and so on, it is represented by the network connected to the host computer program.
STAT: The current state of the program, the main state has
R: The program is currently in operation or can be operated
S: The program is currently sleeping (can be said to be idle) but can be awakened by certain signals (signal).
T: The program is currently detecting or stopping
Z: The program should have been terminated, but the parent program could not properly terminate him, causing the state of the zombie (Xinjiang Corpse) program
Start: The time that the process was triggered to start
Time: The process actually uses the CPU to run
Command: The actual instruction of the program
Example: Find PID numbers related to cron and syslog services [[email protected] test6]# PS aux | Egrep ' (cron|syslog) ' root 2682 0.0 0.0 83384 2000? Sl Nov02 0:00/sbin/rsyslogd-i/var/run/syslogd.pid-c 5root 2735 0.0 0.0 74812 1140? Ss Nov02 0:00 crondroot 17475 0.0 0.0 61180 832 pts/0 s+ 16:27 0:00 egrep (cron|syslog)
by CPU utilization from large to small [[email protected] blog]# ps -e -o "%c : %p : %z : %a" |SORT&NBSP;-NR&NBSP;|HEAD&NBSP;-10%CPU&NBSP;: pid : command 0.0 : 9 : [khelper] 0.0 : 945 : /sbin/rsyslogd -i /var/run/ syslogd.pid -c 5 0.0 : 925 : auditd 0.0 : 8 : [cgroup] 0.0 : 7 : [events/0] 0.0 : 79 : [kstriped] 0.0 : 78 : [kdmremove] 0.0 : 751 : [kauditd] 0.0 : 709 : [ext4-dio-unwrit]
View process by memory from large to small [[email protected] blog]# ps -e -o "%c : %p : % Z : %a " |sort -k5 -nr |head -10 0.0 : 1323 : 577724 : /usr/sbin/console-kit-daemon --no-daemon 0.0 : 28080 : &NBSP;321388&NBSP;:&NBSP;/USR/SBIN/HTTPD&NBSP;0.0&NBSP;:&NBSP;&NBSP;28085&NBSP;:&NBSP;321380&NBSP;:&NBSP;/USR /sbin/httpd 0.0 : 28083 : 321380 : /usr/sbin/httpd 0.0 : 28087 : 321264 : /usr/sbin/httpd 0.0 : 28084 : 321264 : /usr/sbin/httpd 0.0 : 28082 : 321264 : /usr/sbin/ httpd 0.0 : 28081 : 321264 : /usr/sbin/httpd 0.0 : 28086 : 321256 : /usr/sbin/httpd 0.0 : 28078 : 320640 : /usr/sbin/httpd
Linux Performance article--usage of PS