Explanation of the parameters of ps command ps -aux and ps -ef in Linux

Explanation of the parameters of ps command ps -aux and ps -ef in Linux

1. ps command

The ps command is used to display the status of the current process, similar to the task manager of windows.

1.1 ps-aux

Reference materials: Linux ps command | rookie tutorial (runoob.com)

  • command explanation
显示所有包含其他使用者的进程
  • Output format of ps -aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
  • parameter explanation

    • USER: the process owner
    • PID: pid
    • %CPU: occupied CPU usage
    • %MEM: occupied memory usage
    • VSZ: virtual memory size occupied
    • RSS: memory size occupied
    • TTY: minor device number of tty
    • STAT: Status of the trip:
      • D: Uninterruptible sleep state (usually IO process)
      • R: in progress
      • S: static state
      • T: suspend execution
      • Z: does not exist but cannot be eliminated temporarily
      • W: not enough memory pages to allocate
      • <: high priority itinerary
      • N: low priority itinerary
      • L: Memory paging is allocated and locked in memory (real-time system or AI/O)
    • START: Trip start time
    • TIME: execution time
    • COMMAND: the command executed
  • example

    • view all processes
    [root@localhost ~]# ps -aux
    USER        PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
    root          1  0.0  0.1 191412  4400 ?        Ss   19:03   0:02 /usr/lib/systemd/systemd --switched-root --system --deserialize 22
    root          2  0.0  0.0      0     0 ?        S    19:03   0:00 [kthreadd]
    root          4  0.0  0.0      0     0 ?        S<   19:03   0:00 [kworker/0:0H]
    root          6  0.0  0.0      0     0 ?        S    19:03   0:00 [ksoftirqd/0]
    root          7  0.0  0.0      0     0 ?        S    19:03   0:00 [migration/0]
    root          8  0.0  0.0      0     0 ?        S    19:03   0:00 [rcu_bh]
    root          9  0.0  0.0      0     0 ?        S    19:03   0:00 [rcu_sched]
    root         10  0.0  0.0      0     0 ?        S<   19:03   0:00 [lru-add-drain]
    

    image-20230420201730445

    • Find the specified process
    [root@localhost ~]# ps -aux | grep tail
    tom        3869  0.0  0.0 108304   680 pts/2    S+   20:10   0:00 tail
    root       3872  0.0  0.0 112824   980 pts/1    R+   20:10   0:00 grep --color=auto tail
    

    image-20230420201657205

1.2 ps -ef

  • command explanation
列出全部进程的全部信息
  • Output format of ps -ef
UID         PID   PPID  C STIME TTY          TIME CMD
  • parameter explanation

    • UID: the user ID to which the process belongs
    • PID: Process ID of the process
    • PPID: The parent ID of the process (other processes that started this process)
    • C: CPU usage of this process (percentage)
    • STIME: The start time of the process
    • TTY: The serial number of the terminal that started this process, if it displays ?, it means that it is not started by a terminal
    • TIME: The time the process occupies the CPU
    • CMD: the name corresponding to the process or the startup path or the startup command
  • example

    • view progress
    [root@localhost ~]# ps -ef
    UID         PID   PPID  C STIME TTY          TIME CMD
    root          1      0  0 19:03 ?        00:00:02 /usr/lib/systemd/systemd --switched-root --system --deserialize 22
    root          2      0  0 19:03 ?        00:00:00 [kthreadd]
    root          4      2  0 19:03 ?        00:00:00 [kworker/0:0H]
    root          6      2  0 19:03 ?        00:00:00 [ksoftirqd/0]
    root          7      2  0 19:03 ?        00:00:00 [migration/0]
    root          8      2  0 19:03 ?        00:00:00 [rcu_bh]
    root          9      2  0 19:03 ?        00:00:00 [rcu_sched]
    root         10      2  0 19:03 ?        00:00:00 [lru-add-drain]
    

    image-20230420202028547

    • Find the specified process
    [root@localhost ~]# ps -ef | grep tail
    tom        3955   3827  0 20:18 pts/2    00:00:00 tail
    root       4010   3960  0 20:19 pts/3    00:00:00 tail
    root       4042   3065  0 20:21 pts/1    00:00:00 grep --color=auto tail
    

    image-20230420202146898

Guess you like

Origin blog.csdn.net/polaris3012/article/details/130274955