Linux Learning-ps aux instructions

Source: Internet
Author: User

If you use the PS command directly, the status of all processes is displayed, usually in conjunction with the grep command to see the status of a process. If you want to monitor process time, you should use the top tool. The following PS instructions are mainly described below.

Linux process status

In Linux, the process exists in 5 state

    1. Running state (running or waiting in the running queue)
    2. Interrupt state (in hibernation, blocked, waiting for a condition to form or receive a signal)
    3. Non-interruptible (Received signal does not wake up and cannot be run, process must wait until interrupt occurs)
    4. Zombie State (The process has been terminated, but the process descriptor exists until the parent process calls WAIT4 () after the system call is released)
    5. Stop (process received Sigstop, SIGSTP, Sigtin, Sigtou signal after stop running)
PS Common Commands

The following is a common PS instruction to view process status
(1) PS A shows all the programs under the current terminal, including other users ' programs.
(2) Ps-a Show All Programs.
(3) PS C lists the program, displays the actual instruction name of each program, and does not include the path, parameter or the indication of the resident service.
(4) Ps-e The effect of this parameter is the same as specifying the "A" parameter.
(5) When PS e lists the program, it displays the environment variables used by each program.
(6) PS F Displays the tree structure with ASCII characters, expressing the relationship between the programs.
(7) Ps-h shows the tree structure, indicating the relationship between the programs.
(8) Ps-n shows all the programs except the program under the PS Command Terminal.
(9) PS s uses the program signal format to display the program status.
PS S lists programs, including interrupted sub-program data.
(one) Ps-t < terminal number > Specify terminal number and list the status of the program belonging to the terminal.
PS U Displays the status of the program in a user-oriented format.
PS x Displays all programs and is not differentiated by terminals.
Ps-l longer, more detailed information about the PID
All programs of the user under the PS au display terminal

running an instanceExample One: Ps-la | More
$ ps-la |moref S UID PID PPID C PRI NI ADDR SZ Wchan TTY time CMD5 20100800-13212 Ep_pol?00:02:Systemd0 20200800-0 Kthrea?00:00:XX kthreadd1 S0320800-0 Smpboo?00:00:ksoftirqd/01 S052060-20-0 worker?00:00:XX kworker/0:0H1 S0720-40--0 Smpboo?00:00:migration/01 S0820800-0 RCU_GP?00:00:XX rcu_bh0 20920800-0 rcu_no?00:00:XX rcuob/00 201020800-0 rcu_no?00:00:XX rcuob/11 R01120800-0??00:10:Rcu_sched0 201220800-0 rcu_no?00:04:rcuos/00 201320800-0 rcu_no? 00:06:51 rcuos/ 15 S 0 14 2 0-40-- 0 Smpboo? 00:00:16 watchdog/05 S 0 15 2 0-40--0 Smpboo? Span class= "Hljs-number" >00:00:15     

Related Information Explanation:

F  :进程的标志(flag),4表示用户为超级用户S  :进程的状态(stat)PID:进程的IDC  :CPU使用资源的百分比PRI:priority(优先级)的缩写,NI :Nice值,ADDR:核心功能,指出该进程在內存的那一部分,如果是运行的进程,一般都是“-”SZ :用掉的内存的大小WCHAN:当前进程是否正在运行,若为“-”表示正在进行TTY :登陆者的终端位置TIME:用掉的CPU的时间CMD :所执行的指令

Example two: PS aux |more
# PS aux |moreUSER PID%cpu%MEM VSZ RSS TTY STAT START time COMMANDRoot 1 0.0 0.0 52848 5616? Ss July 2:16/usr/lib/systemd/systemd--switched-root--systEM--deserialize 23Root 2 0.0 0.0 0 0? S July 03 0:00[Kthreadd]Root 3 0.0 0.0 0 0? S July 03 0:01[ksoftirqd/0]Root 5 0.0 0.0 0 0? s< July 03 0:00[KWORKER/0:0H]Root 7 0.0 0.0 0 0? S July 03 0:05[migration/0]Root 8 0.0 0.0 0 0? S July 03 0:00[RCU_BH]Root 9 0.0 0.0 0 0? S July 03 0:00[rcuob/0]Root 10 0.0 0.0 0 0? S July 03 0:00[RCUOB/1]Root 11 0.0 0.0 0 0? S July 03 10:41[Rcu_sched]Root 12 0.0 0.0 0 0? R July 03 4:07 [Rcuos/0]root 13 0.0 0.0 0 0? S July 6:51 [Rcuos/1]root 14 0.0 0.0 0 0? S July 0:16 [Watchdog/0]root 15 0.0 0.0 0 0? S July 0:15 [Watchdog/1]root 16 0.0 0.0 0 0? S July 0:06 [Migration/1]root 17 0.0 0.0 0 0? S July 0:23 [Ksoftirqd/1]root 19 0.0 0.0 0 0? s< July 0:00 [Kworker/1:0h]root 20 0.0 0.0 0 0? s< July 0:00 [Khelper]root 21 0.0 0.0 0 0? S July 0:00 [KDEVTMPFS]         

Parameter explanation Description:

USER  进程的属主;PID   进程的ID;PPID  父进程;%CPU  进程占用的CPU百分比;%MEM  占用内存的百分比;NI    进程的NICE值,数值大,表示较少占用CPU时间;VSZ   该进程使用的虚拟內存量(KB);RSS   该进程占用的固定內存量(KB)(驻留中页的数量);TTY   该进程在終端上运行(登陆者的終端位置),若与终端无关,则显示(?)。若为pts/0等,则表示由网络连接主机进程WCHAN 当前进程是否正在运行,若为“-”表示正在运行;START 该进程被触发启动时间;TIME  该进程实际使用CPU运行的时间;COMMAND 命令的名称和参数;

Example three: PS AU

To display the current user's task process

[Liudiwei@master bin]$ PS Auuser PID%cpu%MEM VSZ RSS TTY STAT START time Commandroot23330.00.01165682296 Tty1 ss+July030:00-bashliudiwei55890.00.01168763544 pts/0 ss+August010:02-bashliudiwei60420.00.01233561328 pts/2 r+22:310:XX PS Auliudiwei989667.113.555473403320412 pts/1 310:58464:55Python cross_validation.pyroot137570.00.01167003168 pts/3 ss+21st:010:00-bashliudiwei1510229.26.555514881599236 pts/1 317:1093:41Python submodulary.py1liudiwei155780.00.01168003448 pts/2 Ss17:120:00-bashliudiwei1577728.96.455458761584784 pts/2 R17:1292:14Python submodulary.py7liudiwei1579128.86.455459001578696 pts/2 R17:1291:54Python submodulary.py8liudiwei 15860 29.0 6.4 5536464 1582700 pts/ 2 R 17:13 92:14 python submodulary.py 9liudiwei 15875 28.9 6.4 5542372 1584640 Pts/2 R 17:13 92:04 python submodulary.py 10   

Stat status bit common status character
D 无法中断的休眠状态(通常 IO 的进程);R 正在运行可中在队列中可过行的;S 处于休眠状态;T 停止或被追踪;W 进入内存交换  (从内核2.6开始无效);X 死掉的进程   (基本很少見);Z 僵尸进程;< 优先级高的进程N 优先级较低的进程L 有些页被锁进内存;s 进程的领导者(在它之下有子进程);l 多进程的(使用 CLONE_THREAD, 类似 NPTL pthreads);+ 位于后台的进程组;

Linux Learning-ps aux instructions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.