Ps command usage and parameter description in linux

Source: Internet
Author: User
Tags memory usage cpu usage

Ps command process View command
There are five processes in linux:
1. Run (running or waiting in the running queue)
2. Interruption (in sleep, blocked, waiting for the formation or receipt of a signal of a condition)
3. Do not interrupt (do not wake up when receiving the signal or do not run, the process must wait until there is an interruption)
4. Stiff (the process has been terminated, but the process descriptor exists until the parent process calls wait4 () and is released after the system call)
5. Stop (the process stops running after receiving signals from SIGSTOP, SIGSTP, SIGTIN, and SIGTOU)

Ps command:
1) ps a displays all processes under the current terminal, including those of other users.
2) ps-A displays all processes.
3) when listing processes, ps c displays the real command name of each process, excluding the path, parameter, or resident service identifier.
4) ps-e this parameter has the same effect as the specified "A" parameter.
5) when listing processes, ps e displays the environment variables used by each process.
6) ps f uses ASCII characters to display the tree structure and express the relationship between processes.
7) the ps-H tree structure is displayed, indicating the relationship between processes.
8) ps-N displays all processes, except the processes under the ps command terminal.
9) ps r only displays running processes
10) ps displays the process status in the program signal format.
11) when listing processes in ps, including interrupted sub-processes.
12) ps-t <terminal number> specifies the terminal number and lists the status of processes belonging to the terminal.
13) ps u displays the process status in user-based format.
14) ps x shows all processes, which are not distinguished by terminals.
15) ps-l ??,??? ? ? PID information

A: displays all processes on the terminal, including those of other users.
R only displays running processes
X displays the processes without control terminals.

The three most common parameters are a, u, and x.

# Ps aux output format

User pid % CPU % MEM VSZ RSS TTY STAT START TIME COMMAND
Root 1 0.0 0.0 4772 564? S Sep22 0: 03 init [3]
Root 2 0.0 0.0 0 0? S Sep22 0: 03 [migration/0]
Root 3 0.0 0.0 0 0? SN Sep22 0: 00 [ksoftirqd/0]
Root 4 0.0 0.0 0 0? S Sep22 0: 02 [migration/1]
Root 5 0.0 0.0 0 0? SN Sep22 0: 00 [ksoftirqd/1]
Root 6 0.0 0.0 0 0? Ss + Sep22 0: 02 [migration/2]
Root 7 0.0 0.0 0 0? SN Sep22 0: 00 [ksoftirqd/2]
Root 8 0.0 0.0 0 0? S Sep22 0: 00 [migration/3]
Root 9 0.0 0.0 0 0? SN Sep22 0: 00 [ksoftirqd/3]
Root 10 0.0 0.0 0 0? S <Sep22 0: 00 [migration/4]
USER: Process Owner
PID: Process ID
% CPU: CPU usage
% MEM: memory usage
VSZ; virtual memory used (KB)
RSS: memory used (KB)
TTY: terminal device number (login? ? End location ),? This process is irrelevant to the terminal. pts/0 (Virtual Terminal) is the network link used by this user.
STAT: process status
START: process START time
TIME: execution TIME
COMMAND: The executed COMMAND.

STAT ?? B often? ?? B characters
D. The sleep state that cannot be interrupted (usually the IO process );
R is running or waiting in the running queue;
S is in sleep state;
T stop or be tracked;
W enters the memory switch (it is invalid from kernel 2.6 );
X dead processes (very few ?);
Z botnets;
<Process with a higher priority N process with a lower priority L Some pages are locked into the memory; s process Leader (under which there are sub-processes); l multi-process (using CLONE_THREAD, like NPTL pthreads); + process Group in the background; # ps-lA | more

F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD
4 S 0 1 0 76 0-1193 109952? 00:00:03 init
1 S 0 2 1 0-40--0 migrat? 00:00:03 migration/0
1 S 0 3 1 0 94 19-0 ksofti? 00:00:00 ksoftirqd/0
1 S 0 4 1 0-40--0 migrat? 00:00:02 migration/1
1 S 0 5 1 0 94 19-0 ksofti? 00:00:00 ksoftirqd/1
1 S 0 6 1 0-40--0 migrat? 00:00:02 migration/2
1 S 0 7 1 0 94 19-0 ksofti? 00:00:00 ksoftirqd/2
Phase? What is the meaning of the information? :

F? ? Su I (flag), 4 indicates using ?? Male ?? Use ?? /P>

S? ?? B (stat). What does each STAT mean ?? Below

PID? The ID of the process.

C cpu usage? SOURCE percentage

PRI priority (?? First ?) ???,
NI Nice value,

What are the core functions of ADDR ?? Cheng zai? But why? Why? Qin? Process, generally "-"

Why is SZ used? But why? /P>

WCHAN? Before? Is the process in progress? Line, if ?? Ldquo;-"indicates being? Line

TTY login? ? End location

CPU used out of TIME? R?

CMD? Why? /P>

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.