Pstree, PS, Pidof, Pgrep, top, Htop
I. Pstree-display a tree of processes
1 Yum Install Psmisc//package contains commands Pstree, Killall, Fuser
Ii.ps-report A snapshot of the current processes
Usage:PS [options] u: User-centric organization process state information display A: terminal-related process x: terminal-independent process -e: Show All Processes -f: Show full format program information -F: Show process information in full format- h: Show process-related information in process-level format
Instance:
PS auxuser PID%cpu%MEM VSZ RSS TTY STAT START time commandroot 1 0.0 0.6 193468 6576? Ss 13:49 0:01/usr/lib/systemd/systemd--switched-root--systemroot 2 0.0 0.0 0 0? S 13:49 0:00 [Kthreadd]
The entry meaning: USER: Process is the main PID: Process ID %cpu:cpu occupied time than the%MEM: Memory consumption time than vsz:virtual Virtual memory Set rss:resident Size, resident memory set TTY: Terminal START: Process status r:running S: interruptable Sleeping d:uninterruptable sleeping t:stopped Z:zombie +: Foreground process L: Multithreaded process N: Low-priority process <: high-priority process S: session leader start: Start time : The cumulative duration of the process consuming CPU CO Mmand: Which command the process runs from
[Email protected] ~]#PS-efuid PID PPID C stime TTY time Cmdroot1 0 0 -: the?xx:xx: Geneva/usr/lib/systemd/systemd--switched-root--system--deserialize2Root2 0 0 -: the?xx:xx:xx[Kthreadd]
Each entry means:
UID: Process belongs to master ID
PID: Process ID
PPID: Parent Process ID
C:CPU number
Stime:start time
TTY: Terminal
Time: Process consumes CPU cumulative duration
[Email protected] ~]#PS-efhuid PID PPID C SZ RSS PSR stime TTY time Cmdroot2 0 0 0 0 1 -: the?xx:xx:xx[Kthreadd]root3 2 0 0 0 0 -: the?xx:xx:xx[ksoftirqd/0]
Ps-eo {Pid,tid,class,rtprio,ni,pri,psr,pcpu,stat,comm}
Ps-axo {Stat,euid,ruid,tty,tpgid,sess,pgrp,ppid,pid,pcpu,comm}
Ni:nice value
Pri:priority, priority
Psr:processor,cpu
Rtprio: Real-time priority
Third,pgrep, pkill-look up or signal processes based on name and other attributes
usage: pgrep [options] Pattern pkill [options] Pattern -u uuid:effective user, valid user ID - U uuid:real User, actual userid -t terminal: Process associated with the specified terminal -L: Show process name -A: Show process name in full format -P PID: Displays a list of processes whose parent process is specified for this purpose
Iv.Pidof-Find the process ID of a running program, obtaining its PID based on the process name
Five, Top-display Linux processes, dynamic display of process status
[email protected] ~]# Top
Top- +: +: -Up5: -,3Users, load average:0.00,0.01,0.05Tasks:117Total1Running theSleeping,2Stopped0Zombie%CPU (s):0.0us0.0Sy0.0Ni99.8 ID,0.2Uan0.0Hi0.0Qin0.0Stkib Mem:997980Total454352 Free,154824Used,388804buff/Cachekib Swap:2097148Total2097148 Free,0Used.647980avail Mem PID USER PR NI VIRT RES SHR S%CPU%MEM time+COMMAND703Root - 0 298712 6112 4784S0.3 0.6 0:24.18VMTOOLSD1Root - 0 193468 6576 4088S0.0 0.7 0:02.07systemd2Root - 0 0 0 0S0.0 0.0 0:00.01Kthreadd
Built-in commands:
Sort:
P: Sort by percentage of CPU occupied
M: Sort by percentage of memory occupied
T: Sort by cumulative CPU duration
First message display and close: L key
Tasks and CPU information display and shutdown: T key
CPU displayed separately: Number 1
Memory Information: M key
Modify Refresh time interval: s key
Terminate specified process: K key
Exit command: Q key
Options:
-D #: Specifies the refresh interval, which defaults to 3 seconds
-B: Displayed in batch mode
-N #: Shows how many batches
First line:
top-19:43:38 up 5:53, 3 users, load average:0.00, 0.01, 0.05
Current system time long runtime average number of users logged on in the current system (last minute, five minutes, 15 minutes)
Second line:
tasks:117 Total, 1 running, sleeping, 2 stopped, 0 zombie
Number of processes running the number of processes running state the number of processes in the sleep state processes number of dead states
Third line
%CPU (s): 0.0 us, 0.0 sy, 0.0 ni, 99.8 ID, 0.2 wa, 0.0 hi, 0.0 si, 0.0th
Percentage of user space program occupied kernel space Nice value idle scale wait time for IO to finish processing hardware interrupt handling soft interrupt (mode switch) time spent in virtualization technology
Line Four
KiB mem:997980 Total, 454352 free, 154824 used, 388804 Buff/cache
Physical memory total space free space used space buff and cache occupied space
KiB swap:2097148 Total, 2097148 free, 0 used. 647980 Avail Mem
Total Space free space available
PID USER PR NI VIRT RES SHR S%cpu%MEM time+ COMMAND
Process number process is Master priority Nice value virtual memory set resident memory set shared memory size process state
The Process management tool uses