Under Linux, process viewing and process management are frequently used commands, and we can use PS to view information about each process in the previous state, or to view the process's property information in real time through the top command. The process can be run by kill to adjust the priority of the process by adjusting the Renice value.
Htop, Dstat, and glances are very good Linux system monitoring commands, followed by a step-by-step introduction of their use.
Use of PS
See if PS is a shell built-in command or an external command
[[Email protected] ~]# type PS
PS Is/bin/ps
PS is an external command, the external command can basically be command--help to view the short help information
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/58/B3/wKioL1S4t7ewR_rXAAVbhS1POBQ095.jpg "title=" Qq20150116145840.png "alt=" Wkiol1s4t7ewr_rxaavbhs1pobq095.jpg "/>
View the detailed use of the PS command, man PS
PS: command to display the status of a process, snapshot, one-time
Ps-report a snapshot of the current processes.
Synopsis
PS [Options]
DESCRIPTION
PS Displays information about a selection of the active processes. If you want a
Repetitive (repeat) update of the selection and the displayed information, use Top (1) instead.
Supports two styles: SysV, BSD
This version of PS accepts several kinds of options:
1 UNIX options, which may grouped and must is preceded by a dash.
UNIX options, which may be grouped before, must be preceded by a dash.
2 BSD options, which may is grouped and must not being used with a dash.
BSD options, which may be grouped, must not use dashes.
3 GNU long options, which is preceded by and dashes.
The PS command divides the process into two categories:
Terminal-related processes: a PS a
A Lift the Bsd-style "Only Yourself" restriction, which are imposed upon the set of all processes when some bsd-style (WI Thout "-") options are used or when the personality setting is bsd-like. The set of processes selected in this manner are in addition to the set of processes selected by other means. An alternate description is the This option causes PS to list all processes with a terminal (TTY), or to list all process ES when used together with the X option.
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/58/B5/wKiom1S4u-zgg573AAMUhTZ7Leo721.jpg "title=" Qq20150116151957.png "alt=" Wkiom1s4u-zgg573aamuhtz7leo721.jpg "/>
Terminal-independent processes: x PS x
X Lift the Bsd-style "must has a TTY" restriction, which is imposed upon the set of all processes when some bsd-style ( Without "-") options are used or when the PS personality setting is bsd-like. The set of processes selected in this manner are in addition to the set of processes selected by other means. An alternate description is the This option causes PS to list all processes owned by you (same euid as PS), or to list al L processes when used together with the A option.
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/58/B6/wKiom1S4vODg_pt2AALMSNjiVVc633.jpg "title=" Qq20150116152359.png "alt=" wkiom1s4vodg_pt2aalmsnjivvc633.jpg "/> User-centric display status information: U
U Display user-oriented format
Common combination: PS aux
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/58/B3/wKioL1S4vgLjYSSOAAJKnjlpuEM955.jpg "title=" Qq20150116152527.png "alt=" Wkiol1s4vgljyssoaajknjlpuem955.jpg "/>
User-initiated
PID Process Number
PID PID Process ID number of the process.
%cpu CPU Consumption percentage
%CPU%CPU CPU utilization of the process in "##.#" format. Currently, it is the CPU time used divided by the time the process has been running (cputime/realtime ratio), expressed a s a percentage. It won't add to 100% unless is lucky. (alias Pcpu).
%MEM memory consumption percentage
%mem%mem ratio of the process ' s resident set size to the physical memory on the machine,expressed as a percent Age. (alias Pmem).
Vsz:virtual memory size of linear address space occupied by
vsz vsz Virtual memory size of the process in KiB (1024-byte units). Device mappings is currently excluded; This is the subject to change. (alias Vsize).
RSS: Memory spaces that cannot be swapped out during the use of resident memory sets
RSS RSS resident Set Size, the non-swapped physical memory that a task has used
(in kilobytes). (alias Rssize, Rsz).
Which terminal the TTY is associated with
Stat Status: Status of the process
R:running Running state
R Running or runnable (on run queue)
S: Sleeps can be interrupted
S interruptible sleep (waiting for a event to complete)
D: Non-disruptive sleep
D uninterruptible sleep (usually IO)
t:stopped Stop State
T Stopped, either by a job control signal or because it is being traced.
Z:zombie Zombie State
Z Defunct ("zombie") process, terminated but not reaped by its parent.
S:session leader Session Leader
S is a session leader
+: Foreground process
+ is in the foreground process group
L: Multithreaded Process
L was multi-threaded (using Clone_thread, like NPTL pthreads do)
N: Low-priority process
N low-priority (Nice-to-other users)
<: high-priority process
< High-priority (not nice-to-other users)
COMMAND: The process contained in square brackets is represented as a kernel thread
[Kthreadd] Added [] Description is kernel thread
Common combination: Ps-ef
-e: Show All Processes
-e Select all processes. Identical to-a.
-F: Displays information in full format
-F does Full-format listing. This option can is combined with many other Unix-style
Options to add additional columns. It also causes the command arguments to be printed. When used With-l, the NLWP (number of threads) and LWP (thread ID) columns would be added. See the C option, the Format keyword args, and the Format keyword COMM.
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/58/B3/wKioL1S4wyDxl7LaAARDj0lzq9Y500.jpg "title=" Qq20150116154714.png "alt=" Wkiol1s4wydxl7laaardj0lzq9y500.jpg "/>
Ppid ppid Parent Process ID. The ID of the parent process.
C C Processor utilization. Currently, this is the integer value of the percent usage over the lifetime of the process. (see%CPU).
C PCPU CPU Utilization CPU Usage
Common combination: PS-EFH
-F: Show additional information
-F extra full format. See the-f option, Which-f implies.
-H: Show hierarchy of processes
-H Show process hierarchy (forest)
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/58/B6/wKiom1S4xFCh_UXwAAM3LKk9mdQ028.jpg "title=" Qq20150116155552.png "alt=" Wkiom1s4xfch_uxwaam3lkk9mdq028.jpg "/>
PSR PSR processor that process was currently assigned to. on which CPU, the lab environment is 2 CPUs with a total of 8 cores.
Customize the information you want to display: O
o format specify user-defined format. Identical To-o and--format.
PS Axo Pid,command,psr,pri,ni,.. Need to note o need to write in the back
Ni:nice value
PRI: Superior Class
PSR: Running CPU
Show process number (PID) and parent process number (PPID) running CPU (PRI) and Priority (PRI)
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/58/B3/wKioL1S4yAKS486WAAOafd_fFnU428.jpg "title=" Qq20150116160810.png "alt=" Wkiol1s4yaks486waaoafd_ffnu428.jpg "/>
Use of 2.top
The top:top can be displayed dynamically
Top-display Linux Tasks
Displays Linux Tasks
Synopsis
TOP-HV |-abchimmss-d Delay-n iterations-p pid [, PID ...]
The traditional switches '-' and whitespace are optional.
DESCRIPTION
the top program provides a dynamic Real-time view of a running system. It can display system summary information as well as a list of tasks currently B Eing managed by the Linux kernel. the types of System summary information shown and the types, order and Size of information displayed for tasks is all user configurable and that configuration can BE&N Bsp made persistent across restarts.
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/58/B3/wKioL1S4y4XBl6C5AAZVIPYytEU388.jpg "title=" Qq20150116162304.png "alt=" wkiol1s4y4xbl6c5aazvipyyteu388.jpg "/>
us:user space
sy:system
ni:nice Value adjustment elapsed time percentage
id: Idle percent
wa:wait io Percentage of time that the CPU consumes to wait for the IO event to complete
hi:hardware interrupt
si:soft Interrupt
st: Time taken away by the virtual machine
2c. SUMMARY area fields
the SUMMARY area fields describing CPU statistics is abbreviated. They provide
Summary area fields describe CPU statistics as abbreviations. They provide information about the time spent:
Information about times spent in:
US = user mode
SY = System Mode
NI = Low priority user mode (NICE)
ID = Idle Task
WA = I/o waiting
hi = Servicing IRQs
Si = servicing Soft IRQs
St = Steal (time given to other DomU instances)
VIRT Virtual Memory Set
RES resident Memory Set
SHR Shared Memory Size
S Process State
Input character
M: Percent Memory
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/58/B6/wKiom1S4zNWiJDwfAAWLbRPsWRA578.jpg "style=" float: none; "title=" Qq20150116163019.png "alt=" Wkiom1s4znwijdwfaawlbrpswra578.jpg "/>
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/58/B3/wKioL1S4zaeQdPEwAAZC95dJjF8349.jpg "style=" float: none; "title=" Qq20150116163203.png "alt=" Wkiol1s4zaeqdpewaazc95djjf8349.jpg "/>
P:cpu percent
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/58/B3/wKioL1S4zkbAFGLYAAaBVXbb95Y261.jpg "style=" float: none; "title=" Qq20150116163351.png "alt=" Wkiol1s4zkbafglyaaabvxbb95y261.jpg "/>
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/58/B6/wKiom1S4zXezdB9-AAewMZDBImk743.jpg "style=" float: none; "title=" Qq20150116163448.png "alt=" Wkiom1s4zxezdb9-aaewmzdbimk743.jpg "/>
T: Cumulative CPU Time consumed
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/58/B6/wKiom1S4zfKBV80FAAcZ60Xi2oE768.jpg "title=" Qq20150116163624.png "alt=" Wkiom1s4zfkbv80faacz60xi2oe768.jpg "/>
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/58/B3/wKioL1S4ztbzrmvuAAdlUoa8uao946.jpg "title=" Qq20150116163652.png "alt=" Wkiol1s4ztbzrmvuaadluoa8uao946.jpg "/>
L: Load information is displayed or not displayed
Average load over the past 1 minutes, 5 minutes, 15 minutes
Load average:0.00, 0.00, 0.00
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/58/B4/wKioL1S4z1mjGECJAAT3J95TC3c943.jpg "title=" Qq20150116163841.png "alt=" Wkiol1s4z1mjgecjaat3j95tc3c943.jpg "/>
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/58/B4/wKioL1S4z2uxDzm-AATQtufFSVw512.jpg "title=" Qq20150116163924.png "alt=" Wkiol1s4z2uxdzm-aatqtuffsvw512.jpg "/>
T: Displays or does not display process and CPU-related information
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/58/B6/wKiom1S4z3WQqxPPAAT58YzFHXU852.jpg "title=" Qq20150116164223.png "alt=" wkiom1s4z3wqqxppaat58yzfhxu852.jpg "/>650" this.width=650; "src=" http://s3.51cto.com /wyfs02/m00/58/b6/wkiom1s4z4mraiu4aarqp091no4085.jpg "title=" Qq20150116164320.png "alt=" Wkiom1s4z4mraiu4aarqp091no4085.jpg "/>
1: Numbers, respectively, showing the relevant information of each CPU
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/58/B6/wKiom1S40B2AWpvaAARF-DGHiog528.jpg "title=" Qq20150116164502.png "alt=" wkiom1s40b2awpvaaarf-dghiog528.jpg "/> 650" this.width=650; "src=" http://s3.51cto.com /wyfs02/m00/58/b4/wkiol1s40qcwq477aazbxatlzli460.jpg "title=" Qq20150116164609.png "alt=" Wkiol1s40qcwq477aazbxatlzli460.jpg "/>
M: Displays or does not display information about physical memory and swap memory
Q: Exit
K: Terminates the specified process
S: Modify Refresh time interval
After these actions can be entered on their own, see the changes in the display information, note that after the corresponding characters, and then press again and return to the original display
Common options:
-D #: Specifies the refresh time interval when the refresh time is specified, the number of refreshes can be adjusted
-B: Display the top refresh in batches, all the tasks will be displayed, just flip the way can only press CTRL + C exit
-N #: Displays the batch display # times and automatically exits
These options can be tested on their own to show
Kill uses
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/58/B4/wKioL1S41RyBZ_iMAAVcKry62mc669.jpg "title=" Qq20150116170403.png "alt=" Wkiol1s41rybz_imaavckry62mc669.jpg "/>
[Email protected] ~]# kill-l
1) SIGHUP 2) SIGINT 3) Sigquit 4) Sigill 5) SIGTRAP
6) SIGABRT 7) Sigbus 8) SIGFPE 9) SIGKILL) SIGUSR1
One) (SIGSEGV) (SIGUSR2) sigpipe) sigalrm) SIGTERM
Sigstkflt) (SIGCHLD) Sigcont SIGSTOP) SIGTSTP
(Sigttin) Sigttou () Sigurg) sigxcpu) Sigxfsz
(SIGVTALRM) sigprof) sigwinch SIGIO) SIGPWR
Sigsys) (sigrtmin) sigrtmin+1) sigrtmin+2 Notoginseng) sigrtmin+3
sigrtmin+4) sigrtmin+5 (sigrtmin+6) sigrtmin+7) sigrtmin+8
sigrtmin+9) (sigrtmin+10) sigrtmin+11 () sigrtmin+12) sigrtmin+13
(sigrtmin+14) sigrtmin+15 () SIGRTMAX-14) SIGRTMAX-13) SIGRTMAX-12
SIGRTMAX-11) SIGRTMAX-10 SIGRTMAX-9) SIGRTMAX-8 () SIGRTMAX-7
(SIGRTMAX-6) (SIGRTMAX-5) SIGRTMAX-4) SIGRTMAX-3) SIGRTMAX-2
SIGRTMAX-1) Sigrtmax
[Email protected] ~]# kill-19 13065
Renice to change the priority of the running process
Renice-alter priority of running processes
Synopsis
Renice [-N] Priority [[-P] pid ...] [[-G] pgrp ...] [[-u] user ...]
renice-h | -V
DESCRIPTION
Renice alters the scheduling priority of one or more running processes. The following who parame-ters is interpreted as process ID ' s, process group ID ' s, or user names.
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/58/B7/wKiom1S41_qhOM7tAAVcOLIJ3vY403.jpg "title=" Qq20150116171558.png "alt=" Wkiom1s41_qhom7taavcolij3vy403.jpg "/>
[Email protected] ~]# renice-10-p 13037
13037:old priority 0, new priority-10
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/58/B4/wKioL1S42NjhjZv-AAXJvCrPS-g990.jpg "title=" Qq20150116171933.png "alt=" Wkiol1s42njhjzv-aaxjvcrps-g990.jpg "/>
This article is from the "Happy is good" blog, please be sure to keep this source http://wdllife.blog.51cto.com/6615958/1604873
Linux process management and system monitoring ps,top