Ways to view processes and kill zombie processes in Linux systems

Source: Internet
Author: User
Tags command line

PS command

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:

PS [Options]

-e Displays all processes, environment variables

-F Full format

-H does not display title

-L Long format

-W Wide output

A

Show all processes on the terminal, including other user processes

R

Show only processes that are running

X

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

C

Cmd

Executable Simple Name

C

CmdLine

Full command line

F

Flags

Long mode flag

G

Pgrp

Process Group ID

G

Tpgid

Controlling the 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

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

Copy Code

The code is as follows:

Ps-a-ostat,ppid,pid,cmd | Grep-e ' ^[zz] '

Example:

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

Copy Code

The code is as follows:

Kill-hup Ppid

Postscript

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.

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

11.11 Big Sale for Cloud

Get Unbeatable Offers with up to 90% Off,Oct.24-Nov.13 (UTC+8)

Get It Now >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.