ps command
ps command is the most basic and very powerful process viewing command under certain circumstances. Use this command to determine which processes are running and their running status, whether the process has ended, whether the process has died, and which processes have occupied the process. Many resources, etc. In short, most of the information can be obtained by executing this command.
ps command and its parameters
ps command is most often used to monitor the working status of the background process, because the background process is not It communicates with standard input/output devices such as the on-screen keyboard, so if you need to detect its situation, you can use the ps command. The syntax of this command is as follows: ps [option] -e displays all processes and environment variables
-f full format
-h does not display the title
-l long format
-w wide output
a
Displays all processes on the terminal, including processes of other users
r
Only displays running processes
x
Displays none Control terminal processes
O[+|-] k1 [,[+|-] k2 [,…]] Display the process list according to the multi-level sorting order specified by the shortcut keys in SHORT KEYS, k1, k2.
It is different for ps There are default order specifications for formats. These default orders can be overridden by user specifications. The "+" character is optional, and the "-" character inverts the specified key direction.
pids only lists process IDs characters, separated by commas. The process list must be given immediately after the last option of the command line parameter, and no spaces can be inserted in the middle. For example: ps -f1,4,5.
The long command line options are introduced below. Options all start with "--":
--sort Because the default direction is in ascending numerical order or dictionary order. For example: ps -jax -sort=uid,-ppid,+pid.
--help displays help information.
--version displays the version information of this command.
The sort key was mentioned in the previous option description, and the sort key will be further explained next. It should be noted that the value used in sorting is the internal value used by ps, not a pseudo value only used in some output formats. The sort key The list is shown in Table 4-3.
Sort key list
c
cmd
Executable simple name
C
cmdline
Full command line
f
flags
Long mode flag
g
pgrp
Process 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
Minor page fault
Find Zombie process
First of all, when the desktop program is stuck, you can try to enter other tty terminals. Switching method: ctrl + alt + [1,2,3,4,5,6,7], 7 is the desktop terminal
ps -A -ostat,ppid,pid,cmd | grep -e '^[zZ]'PostscriptI don’t know why I still have this zombie process after logging out and logging back in. I wonder if it is It is a bug of LightDM, but Ubuntu12.04 desktop display manager is LightDM, so kill -HUP at least plays the role of logging out, no need to restart
More View processes and kill zombie processes in Linux system For articles related to the method, please pay attention to the PHP Chinese website!