PS commands in Linux

Source: Internet
Author: User

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)

Five status codes used by the PS tool to identify a process:
D. uninterruptible sleep (usually Io) cannot be interrupted)
R run runnable (on run Queue)
S interrupt sleeping
T stop traced or stopped
Z dead a defunct ("zombie") Process

Name: PS
Permission: All Users
Usage: PS [Options] [-- help]
Views: displays the dynamics of the instantaneous process.
Parameters:
There are many PS parameters. Only a few common parameters are listed here and their meanings are briefly described.
-A: list all the itineraries.
-W display widening can display more information
-Au displays more detailed information
-Aux: Show All itineraries containing other users

Au (x) output format:

User PID % CPU % mem vsz RSS tty stat Start Time Command
User: trip owner
PID: PID
% CPU: CPU usage
% Mem: memory usage
Vsz: Virtual Memory Used
RSS: memory used
TTY: the secondary device Number of the terminal (minor device Number of TTY)
Stat: the status of the trip:
D: Non-disruptive static
R: Execution in progress
S: static
T: Pause execution
Z: it does not exist but cannot be eliminated for the moment.
W: insufficient memory paging allocable
<: High-priority itinerary
N: low-priority itinerary
L: memory is allocated by PAGE and locked in the memory (instant system or memory a I/O)
Start: Start Time of the trip
Time: execution time
Command: The executed command.

Example:

PS
PID tty time cmd
2791 ttyp0 00:00:00 tcsh
3092 ttyp0 00:00:00 PS
% PS-
PID tty time cmd
1? 00:00:03 init
2? 00:00:00 kflushd
3? 00:00:00 kpiod
4? 00:00:00 kswapd
5? 00:00:00 mdrecoveryd
.......
% PS-Aux
User PID % CPU % mem vsz RSS tty stat Start Time Command
Root 1 0.0 0.7 1096 472? S sep10 0: 03 init [3]
Root 2 0.0 0.0 0 0? SW sep10 0: 00 [kflushd]
Root 3 0.0 0.0 0 0? SW sep10 0: 00 [kpiod]
Root 4 0.0 0.0 0 0? SW sep10 0: 00 [kswapd]

The specific commands are described as follows:
1) pS A shows all programs under the current terminal, including those of other users.

2) PS-A shows all programs.

3) when listing programs in ps c, the real command name of each program is displayed without the path, parameter or resident service identifier.

4) the effect of this parameter is the same as that of the specified "A" parameter.

5) when listing programs, PS e displays the environment variables used by each program.

6) pS F uses ASCII characters to display the tree structure and express the relationship between programs.

7) the PS-H tree structure is displayed, indicating the relationship between programs.

8) PS-n shows all programs, except the programs under the ps command terminal.

9) pS displays the program status in the program signal format.

10) when listing programs in PS, it includes interrupted subroutines.

11) PS-T <terminal number>

Specify the terminal number and list the status of the program that belongs to the terminal.

12) pS u

Display the program status in user-based format.

13) pS x

Show all programs, not distinguished by terminals.

The most common method is PS-Aux. Then, a pipeline symbol is used to direct to grep to find a specific process and then operate on the specific process.

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.