The kill application is used together with the ps or pgrep command [root @ localhost ~] # Psauxf | grephttpdroot49390.00.05160708pts/3 S + 13:100:00 \ _ grephttpdroot48300.11.324232102...
The kill application is used together with the ps or pgrep command [root @ localhost ~] # Ps auxf | grep httpdroot 4939 0.0 0.0 5160 708 pts/3 S + \ _ grep httpdroot 4830 0.1 1.3 24232 10272? Ss/usr/sbin/httpdapache 4833 0.0 0.6 24364? S \ _/usr/sbin/httpdapache 4834 0.0 0.6 24364 4928? S \ _/usr/sbin/httpdapache 4835 0.0 0.6 24364 4928? S \ _/usr/sbin/httpdapache 4836 0.0 0.6 24364 4928? S \ _/usr/sbin/httpdapache 4837 0.0 0.6 24364 4928? S \ _/usr/sbin/httpdapache 4838 0.0 0.6 24364 4928? S \ _/usr/sbin/httpdapache 4839 0.0 0.6 24364 4928? S \ _/usr/sbin/httpdapache 4840 0.0 0.6 24364 4928? S 13:02 \ _/usr/sbin/httpd www.2cto.com we can view the httpd server process; you can also use pgrep-l httpd to view it; we can see the second column in the above example, is the process PID column, where 4830 is the parent process of the httpd server, and all processes from 4833-4840 are their 4830 sub-processes. if we kill the parent process 4830, the sub-processes under it will also die;
[Root @ localhost ~] # Kill 4840 note: kill the 4840 process. [root @ localhost ~] # Ps-auxf | grep httpd note: What are the results? Is the httpd server still running? [Root @ localhost ~] # Kill 4830 note: kill the httpd parent process. [root @ localhost ~] # Ps-aux | grep httpd note: Check whether other httpd sub-processes exist and whether the httpd server is still running? For zombie processes, kill-9 can be used to force termination and exit. for example, if a program has completely died, kill cannot exit without signal strength, the best solution is to add signal strength-9, followed by killing the parent process; for example, [root @ localhost ~] # Ps aux | grep gaimbeinan 5031 9.0 2.3 104996 17484? S gaimroot 5036 0.0 0.0 5160 724 pts/3 S + grep gaim or www.2cto.com [root @ localhost ~] # Pgrep-l gaim5031 gaim [root @ localhost ~] # Kill-9 5031
2 killallkillall directly kills all processes by program name. Usage: killall is a running program name. killall is also used with ps or pgrep for convenience. you can use ps or pgrep to check which programs are running. for example: [root @ localhost beinan] # pgrep-l gaim2979 gaim [root @ localhost beinan] # imaginecup by killall gaim author
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.