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 CMD4S0     1     0  0   the   0-13212Ep_pol?xx: Geneva: -Systemd1S0     2     0  0   the   0-0Kthrea?xx:xx:xxKthreadd1S0     3     2  0   the   0-0Smpboo?xx:xx: onksoftirqd/01S0     5     2  0   -- --0Worker?xx:xx:xxkworker/0:0H1S0     7     2  0- +- -0Smpboo?xx:xx: tomigration/01S0     8     2  0   the   0-0Rcu_gp?xx:xx:xxRcu_bh1S0     9     2  0   the   0-0Rcu_no?xx:xx:xxrcuob/01S0    Ten     2  0   the   0-0Rcu_no?xx:xx:xxrcuob/11R0     One     2  0   the   0-0? ?xx:Ten: ARcu_sched1S0     A     2  0   the   0-0Rcu_no?xx:Geneva: -rcuos/01S0     -     2  0   the   0-0Rcu_no?xx: .:Wuyircuos/15S0     -     2  0- +- -0Smpboo?xx:xx: -watchdog/05S0     the     2  0- +- -0Smpboo?xx:xx: the 

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 |moreUSERPID%cpu%MEM VSZ RSS TTY STAT START time COMMANDRoot1 0.0 0.0 52848 5616? Ss July 2:16/usr/lib/systemd/systemd--switched-root--system--deserialize 23Root2 0.0 0.0 0 0? S July 03 0:00[Kthreadd]Root3 0.0 0.0 0 0? S July 03 0:01[ksoftirqd/0]Root5 0.0 0.0 0 0? s< July 03 0:00[kworker/0:0h]Root7 0.0 0.0 0 0? S July 03 0:05[migration/0]Root8 0.0 0.0 0 0? S July 03 0:00[RCU_BH]Root9 0.0 0.0 0 0? S July 03 0:00[rcuob/0]Root10 0.0 0.0 0 0? S July 03 0:00[RCUOB/1]Root11 0.0 0.0 0 0? S July 03 10:41[rcu_sched]Root12 0.0 0.0 0 0? R July 03 4:07[rcuos/0]Root13 0.0 0.0 0 0? S July 03 6:51[RCUOS/1]Root14 0.0 0.0 0 0? S July 03 0:16[watchdog/0]Root15 0.0 0.0 0 0? S July 03 0:15[WATCHDOG/1]Root16 0.0 0.0 0 0? S July 03 0:06[MIGRATION/1]Root17 0.0 0.0 0 0? S July 03 0:23[KSOFTIRQD/1]Root19 0.0 0.0 0 0? s< July 03 0:00[kworker/1:0h]Root20 0.0 0.0 0 0? s< July 03 0:00[Khelper]Root21 0.0 0.0 0 0? S July 03 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@masterbin]$ PS Auuser PID%cpu %MEMVSZ RSS TTY STAT START time Commandroot2333  0.0  0.0 116568  2296Tty1 ss+7MonthGeneva   0:xx-bashliudiwei5589  0.0  0.0 116876  3544pts/0ss+8Month on   0: Geneva-bashliudiwei6042  0.0  0.0 123356  1328pts/2r+ A: to   0:xxPS Auliudiwei9896 67.1 13.5 5547340 3320412pts/0RTen: - 464: - pythonCross_validation.pyroot13757  0.0  0.0 116700  3168pts/3ss+ +: on   0:xx-bashliudiwei15102 29.2  6.5 5551488 1599236pts/0R -:Ten   the: A pythonsubmodulary.py1Liudiwei15578  0.0  0.0 116800  3448pts/2Ss -: A   0:xx-bashliudiwei15777 28.9  6.4 5545876 1584784pts/2R -: A   the: - pythonsubmodulary.py7Liudiwei15791 28.8  6.4 5545900 1578696pts/2R -: A   the: Wu pythonsubmodulary.py8Liudiwei15860 29.0  6.4 5536464 1582700pts/2R -: -   the: - pythonsubmodulary.py9Liudiwei15875 28.9  6.4 5542372 1584640pts/2R -: -   the:Geneva pythonsubmodulary.pyTen
Stat status bit common status character
D 无法中断的休眠状态(通常 IO 的进程);R 正在运行可中在队列中可过行的;S 处于休眠状态;T 停止或被追踪;W 进入内存交换  (从内核2.6开始无效);X 死掉的进程   (基本很少見);Z 僵尸进程;< 优先级高的进程N 优先级较低的进程L 有些页被锁进内存;s 进程的领导者(在它之下有子进程);l 多进程的(使用 CLONE_THREAD, 类似 NPTL pthreads);+ 位于后台的进程组;

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

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.