PS command is the most fundamental corresponding case is also quite strong ground process view command. Use this command to determine which processes are running and running, whether the process is over, if the process is dead, which processes are consuming too much resources, and so on. In summary, most of the information is available by executing the command.
PS command and its parameters
The PS command is used most often to monitor the work of the background process, because the background process is not and the on-screen keyboard these standard input/output set
Ready for communication, so if you need to detect the situation, you can use the PS command.
The command syntax is formatted as follows:
-e Displays all processes, environment variables
-F Full format
-H does not display title
-L Long format
-W Wide output
Show all processes on the terminal, including other user processes
Show only processes that are running
Show no control of terminal process
o[+|-] K1 [, [+|-] K2 [,...]] Displays a list of processes based on the multilevel sort order specified by shortcut keys in the short keys, K1, and K2.
The default order designation exists for different PS formats. These default orders can be overridden by user-specified. In this case the "+" character is Optionally, "-" the character is inverted to the specified key locally.
PIDs lists only process identifiers, separated by commas. The process list must be given immediately after the last option in the command line argument, and no spaces can be inserted in the middle. For example: ps-f1,4,5.
The following describes the long command-line options, which start with "--":
--sort x[+|-] key [, [+|-] key [,...]] Select a multiple letter key from the Sort keys section. " + "character is optional, because the default direction is in ascending numeric or dictionary order. 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 needs to be noted that the use of the value in the sort is the internal value of the PS application, not just the pseudo value for some output formats. The Sort keys list is shown in table 4-3.
Sort Key List
Executable Simple Name
Full command line
Long mode flag
Process Group ID
Controlling the TTY process group ID
Cumulative User Time
Cumulative system time
Secondary page fault
Find Zombie Process
First, when the desktop program is stuck, you can try to enter other TTY terminals. Toggle Mode: CTRL + ALT + [1,2,3,4,5,6,7],7 is desktop terminal
Second, you can use the top command to see if there are currently zombie processes
The number of zombie processes can be seen from the above figure, and Num Zombie,num is greater than 0, which means that the system has zombie processes
Finally, using the PS command to find the zombie process
The code is as follows:
Ps-a-ostat,ppid,pid,cmd | Grep-e ' ^[zz] '
Kill the Zombie process
Direct kill-9 Zombiepid is not effective because zombie indicates that the process has exited, wants to clean up such a process, needs to clear its parent process or wait a long time after the kernel clears it
The code is as follows:
I don't know why I log in again after logging off and this zombie process, wondering if it's a LIGHTDM bug, but Ubuntu12.04 desktop display manager is LIGHTDM, so Kill-hup has at least played a role in logoff, No need to reboot.