Http://linux.net527.cn/Linuxwendang/xitongguanliyuan/39094.htmlLinux Operating System PS Command detailed analysis of the system to monitor the process of control, with the PS command to meet you. /bin/ps PS is the state of the instantaneous stroke, not dynamic and continuous; If you want to monitor the process run time, you should use the top tool. Kill is used to kill the process.
about PS
To monitor and control the process, you must first understand the current process, that is, to see the current process, and the PS command is the most basic and very powerful process view command. Use this command to determine which processes are running and running, whether the process is complete, if the process is zombie, which processes are consuming too many resources, and so on. In short, most of the information can be obtained by executing the command. View process start time PS afx-o pid,args,etime,stime|grep processstime start time, format: When: minutes etime run how long, format: When: Sub-lstart start time, format: Month-day time: minute: Second year
Linux Operating System PS command detailed parsing
To monitor and control processes in the system, use the PS command to satisfy you.
/bin/ps
PS is to show the state of the instantaneous stroke, not dynamic continuous, if you want to monitor the process run time, you should use the top tool.
Kill is used to kill the process.
==============ps parameter Description ============================
l long format output;
U displays the process in the order of the user name and start time;
J Use the task format to display the process;
F to display the process in a tree-shaped format;
A shows all processes of all users (including other users);
X shows the process without control terminal;
R shows the running process;
WW avoids detailed parameters being truncated;
-A lists all trips
-W display widen to show more information
-au Show more detailed information
-aux Show all itineraries that contain other users
-e Show all processes, environment variables
-F Full format
-H does not display the caption
-L Long format
-W Wide output
A shows all processes on the terminal, including other user processes
R shows only the running process
X shows no control of the terminal process
Our common options are the combination of aux or lax, and the application of parameter F.
o[+|-] K1 [, [+|-] K2 [,...]] Displays the list of processes according to the shortcut keys specified in the short keys, K1, K2, and in the multilevel sort order.
There are default order designations for different formats for PS. These default orders can be overridden by the user's designation. In this case the "+" character is optionally, the "-" character is inverted the specified key to the local direction.
PIDs lists only the process identifiers, separated by commas. The process list must be given immediately after the last option in the command-line argument, with no spaces inserted in the middle. For example: ps-f1,4,5.
The following describes the long command-line options, which begin with "--":
--sort x[+|-] key [, [+|-] key [,...]] Select a multi-letter key from the Sort keys section. " The + "character is optional, because the default orientation is in ascending or dictionary order by number. For example: ps-jax-sort=uid,-
Ppid,+pid.
--HELP Displays help information.
--version Displays the version information for this command.
The sort key is mentioned in the previous option description and the sort key is further explained. It is important to note that the value used in the sorting is the intrinsic value of PS, not only for some output format pseudo-values. The list of sort keys is shown in the table below.
============ sort Key List ==========================
C cmd executable simple name
C cmdline full command line
F Flags Long mode flag
G PGRP process Ground Group ID
G Tpgid Control TTY process group ID
J Cutime Cumulative User Time
J Cstime Cumulative system time
K Utime User Time
K stime System Time
M Min_flt number of minor pages incorrectly
M Maj_flt Key page erroneously number
n Cmin_flt Cumulative Minor page error
N Cmaj_flt Cumulative Key page error
o Session Dialog ID
P PID Process ID
P PPID Parent Process ID
R RSS Resident Size
R Resident Resident Page
s size memory size (Kbytes)
S share number of shared pages
T TTY TTY minor device number
T start_time Process Start-up time
U UID UID
U user username
V vsize Total Virtual memory amount in bytes
Y priority Kernel scheduling priorities
=================ps explanation of aux or lax output =========================
2. Explanation of PS aux or lax output
AU (x) output format:
USER PID%cpu%MEM VSZ RSS TTY STAT START time COMMAND
USER: Process Owner
PID: Process ID
%CPU: CPU Usage consumed
%MEM: Memory usage consumed
VSZ: The amount of virtual memory occupied
RSS: The amount of memory consumed
TTY: Secondary device number for the terminal (minor device numbers of TTY)
STAT: Process Status:
Start: The time to start the process;
Time: How long the process consumes the CPU;
Command: The name and parameters of the commands;
================= Process Stat Status ====================
D a dormant state (usually IO process) that cannot be interrupted;
R is running in an interruptible queue;
S in hibernation, stationary state;
T stop or be traced, suspend execution;
W enters memory swap (invalid starting from kernel 2.6);
X the process of dying out;
Z Zombie process does not exist but cannot be eliminated temporarily;
W: Not enough memory paging to allocate
Wchan the process resources being awaited;
<: high-priority process
N: Low Priority sequence process
L: Memory paged and locked in memory (instant system or I/O), that is, some pages are locked into memory
Leader of the S-process (under it there are sub-processes);
L multi-process (using Clone_thread, similar to NPTL pthreads);
+ Process Group located in the background;
================kill Terminate Process =========================
Kill terminates the process
There are more than 10 ways to control the process, here are some common methods:
Kill-stop [PID]
Send Sigstop (17,19,23) to stop a process without destroying it.
Kill-cont [PID]
Send Sigcont (19,18,25) to restart a stopped process.
Kill-kill [PID]
Send Sigkill (9) forces the process to stop immediately and does not implement a cleanup operation.
Kill-9-1
Stop all the processes you have.
SIGKILL and SIGSTOP signals cannot be captured, blocked, or ignored, but other signals can. So this is your ultimate weapon.
================= Example ========================
$ ps
PID TTY Time COMMAND
5800 ttyp0 00:00:00 Bash
5835 TTYP0 00:00:00 PS
As you can see, the display project is divided into four items, which are PID (process ID), TTY (terminal name), time (Process execution times), command (the process commands line input).
You can use the U option to view the process owner and a little more detail, as follows:
$ ps U
USER PID%cpu%MEM USZ RSS TTY STAT START time COMMAND
Test 5800 0.0 0.4 1892 1040 Ttyp0 S Nov27 0:00-bash
Test 5836 0.0 0.3 2528 856 ttyp0 R Nov27 0:00 PS u
There is a horizontal line in front of the bash process, which means that the process is the user logging in to the shell, so there is only one process for a logged-on user with a dash. You can also see the%CPU,%mem two options, the former refers to the process occupies the CPU time
And the total time in percent; the latter refers to the amount of memory that the process occupies and the percentage of total memory.
In this case, you see all the control of the terminal process, of course, for other those who do not control the terminal process is not observed, so the need to apply the X option. The x option allows you to observe all process conditions.
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 listing the program, PS e 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 when listing programs, including interrupted sub-program data.
ps-t< Terminal number > Specify the 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 does not differentiate by terminal.
The most commonly used method is PS aux (the command with no-aux in front of the Add-symbol command will be more than the plus-sign commands), and then use the pipe symbol to be directed to grep to find a particular process, and then work on a particular process.
More articles:Linux PS Command Introduction-http://www.cnblogs.com/allen8807/archive/2010/11/10/1873843.html
Linux PS View process commands in a detailed