Tag Archives: aux

Detailed explanation of PS AUX output parameter meaning

Detailed explanation of PS AUX output parameter meaning



Run PS aux to the following information:
PS aux
User PID% CPU% MEM vsz RSS TTY stat start time command
smmsp 3521 0.0 0.7 6556 1616?SS 20:400:00 sendmail: queue runner@01 :00:00 f
root 3532 0.0 0.2 2428 452 ? Ss 20:40 0:00 gpm -m /dev/input/mice -t imps2
htt 3563 0.0 0.0 2956 196 ? Ss 20:41 0:00 /usr/sbin/htt -retryonerror 0
htt 3564 0.0 1.7 29460 3704 ? Sl 20:41 0:00 htt_ server -nodaemon
root 3574 0.0 0.4 5236 992 ? Ss 20:41 0:00 crond
xfs 3617 0.0 1.3 13572 2804 ? Ss 20:41 0:00 xfs -droppriv -daemon
root 3627 0.0 0.2 3448 552 ? SNs 20:41 0:00 anacron -s
root 3636 0.0 0.1 2304 420 ? Ss 20:41 0:00 /usr/sbin/atd
dbus 3655 0.0 0.5 13840 1084 ? Ssl 20:41 0:00 dbus-daemon-1 –The meaning of parameters in system
……
stat is as follows:
d uninterruptible (normally IO)
R is running, or the process in the queue is in sleep
t stopped or tracked
Z zombie process
W enters memory exchange (invalid from kernel 2.6)
x dead process

& lt; High priority
n low priority
s contains child processes
+ process groups in the background
n

The user field indicates which user started the command;
users can view how much CPU a process has occupied;
memory usage and its vsz (virtual memory size) and RSS (resident set size):
vsz indicates how much memory space a program needs to occupy if it completely resides in memory;
RSS indicates how much memory it actually occupies;
Stat shows the current state of the process

======================================

PS command
to monitor and control the process, you must first understand the current process, that is, you need to view the current process, The PS command is the most basic and powerful process view command In a word, most of the information can be obtained by executing this command.
PS command is most commonly used to monitor the work of background processes, Because the background process does not communicate with the standard input/output devices such as screen keyboard, if you need to detect its condition, you can use the PS command.
1) PS a displays all the programs under the current terminal, including the programs of other users.
2) PS – a shows all programs.
3) When PS C lists programs, the real instruction name of each program is displayed, without the path, parameter or resident service identifier.
4) PS – e this parameter has the same effect as the “a” parameter.
5) When PS e lists programs, the environment variables used by each program are displayed.
6) PS f uses ASCII characters to display the tree structure and express the relationship between programs.
7) PS – H shows the tree structure, indicating the relationship between programs.
8) PS – N displays all the programs except the ones under the PS instruction terminal.
9) PS s uses program signal format to display program status.
10) PS s lists the programs, including the interrupted subroutine data.
11) PS – T & lt; terminal number &> specifies the terminal number and lists the status of the program that belongs to the terminal.
12) PS u displays the program status in a user based format.
13) PS x shows all programs, not by terminal.
The most common method is PS – aux, and then use a pipeline symbol to guide to grep to find a specific process, and then operate on a specific process.

processes on Linux have five states:
1. Running (running or waiting in the running queue)
2. Interrupt (sleeping, blocked, waiting for the formation of a condition or receiving a signal)
3. Non interruptible (receiving a signal does not wake up and cannot run, the process must wait until an interrupt occurs)
4. Dead (the process has terminated, but the process descriptor exists, Until the parent process calls wait4() and releases it after system call)
5. Stop (the process stops after receiving sigstop, sigstp, sigtin, sigtou signals)

PS tool identifies five status codes of a process:
d uninterruptible sleep (usually IO)
R runnable (on run queue)
s interrupt sleeping
t stopped or tracked
Z deadened a defunct (“zombie”) process

Note: other states include w (no resident page), & lt; (high priority process), n (low priority process), l (memory lock page)

Use PS format output to view process status:
PS – EO user, stat.., CMD

User name
uid user number
PID process number
PPID parent process number
size memory size, Kbytes.
vsize total virtual memory size, bytes (including code + data + stack)
share total shared pages
nice process priority (default is 0, maximum is – 20)
priority (PRI) kernel scheduling priority
percentage of physical memory shared by pmem process
trs Program execution code resident size
total physical memory used by RSS process, Kbytes bytes
total CPU transient time from process execution to present
stat process status
simple format of CMD (args) command execution

Example:
View uid, PID, stat, PRI of the current system process, sorted by uid number.
PS – EO, PID, stat, PRI, UID – sort UID

View the user, PID, stat, RSS, args of the current system process, sorted by RSS.
PS – EO user, PID, stat, RSS, args – sort RSS

Name: ps
permission: all users
usage: PS [options] [– help]
Description: display the dynamic parameters of the transient process
parameters:
PS has many parameters, Only a few commonly used parameters are listed here and the meaning is briefly introduced
– a list all trips
– W display widening can display more information
– AU display more detailed information
– aux display all trips including other users

Au (x) output format:

User PID% CPU% MEM vsz RSS TTY stat start time command
User: trip owner
PID: PID
% CPU: occupied CPU utilization rate
% MEM: occupied memory utilization rate
vsz: occupied virtual memory size
RSS: occupied memory size
TTY: terminal’s minor device number of TTY
stat: the status of the trip:
D: non interruptible quiescence
R: in execution
s: quiescent state
t: pause execution
Z: pause execution Does not exist but cannot be eliminated temporarily
W: there are not enough memory pages to allocate
& lt; : high priority itinerary
n: low priority itinerary
L: with memory paging allocation and locked in memory
Start: itinerary start time
time: execution time
command: instructions executed

example:

ps
PID TTY time CMD
2791 ttyp0 00:00:00 tcsh
3092 ttyp0 00:00:00 ps
% PS – a
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]
……..

To monitor and control the process, we must first understand the current process, that is, we need to view the current process, and PS command is the most basic and very powerful process view command. This command can be used to determine which processes are running and their running status, whether the processes are finished, whether the processes are dead, which processes occupy too many resources, and so on. In short, most of the information can be obtained by executing the command.

PS provides us with a one-time view of the process, and the view results it provides are not dynamic and continuous; if you want to monitor the process time, you should use the top tool.

kill is used to kill processes.

1. PS parameter description
PS provides many option parameters, which are commonly used as follows:

L output in long format;
u display processes in the order of user name and start time;
J display processes in task format;
F display processes in tree format;

a display all processes of all users (including other users);
x Show the process without control terminal;
R show the running process;
WW avoid truncation of detailed parameters;

our common options are combination aux or lax, and application of parameter F.

2. Explanation of PS aux or lax output
owner of user process;
ID of PID process;
PPID parent process;
% CPU percentage occupied by CPU process;
% MEM percentage occupied by memory;
nice value of Ni process, large value, less CPU time occupied;
virtual size of vsz process;
number of pages in RSS resident;
TTY terminal ID
stat Process state (there are the following)

d sleep state that cannot be interrupted (usually IO process);
R is running and can cross the line in the queue;
s is in sleep state;
t stops or is tracked;
W enters memory exchange (invalid from kernel 2.6);
x dead process (never seen);
Z zombie process;

& lt; Process with higher priority
n process with lower priority
L some pages are locked into memory;
s process leader (there are child processes under it);
L multi process (using clone)_ Thread, similar to NPTL pthreads);
+ process group in the background;
process resources that wchan is waiting for;
start process time;
CPU time consumed by time process;
name and parameters of command command;

3. Application examples
3[ root@localhost ~]#PS – aux | more
can be viewed in pages by connecting | pipe and more.
[ root@localhost ~]# ps -aux &> ps001.txt
[ root@localhost ~]#More ps001. TXT
here, all processes are displayed and output to ps001.txt file, and then paged through more.

4. There are more than ten ways to control a 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 sigcon (19,18,25) to restart a stopped process.
Kill – kill [PID]
send sigkill (9) to force the process to stop immediately without cleaning up.
kill -9 -1