Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
i'm root. i use ps to find out pid of processse i wanna kill. i type "kill xxx" but the process is still there ! what the heck ...!?
if you want to kill the program you dont need the pid in root. just type killall then the program name killall all together . if i want to stop my dialup program I type killall pppd
Try kill -9 'pid'. Kill uses TERM by default, and a running process might be hung and not respond to TERM, -9 is the KILL signal, and it terminates a process ungracefully.
Try kill -9 'pid'. Kill uses TERM by default, and a running process might be hung and not respond to TERM, -9 is the KILL signal, and it terminates a process ungracefully.
thanks.
[root@localhost /]# ps
PID TTY TIME CMD
4662 pts/0 00:00:00 bash
5732 pts/0 00:00:00 yum
5764 pts/0 00:00:00 yum
6854 pts/0 00:00:00 man
6876 pts/0 00:00:00 sh
6878 pts/0 00:00:00 less
6900 pts/0 00:00:00 man
6921 pts/0 00:00:00 sh <defunct>
6923 pts/0 00:00:00 less
6978 pts/0 00:00:00 man
6999 pts/0 00:00:00 sh <defunct>
7001 pts/0 00:00:00 less
7305 pts/0 00:00:00 man
7326 pts/0 00:00:00 sh <defunct>
7520 pts/0 00:00:00 ps
i tried "kill -9 PID" and those i tried are shown "defunct" above. if i ps again, it still shows this screen. however, when i wrote C programs under unix days ago i only needed to use "kill PID" only. Also, once i killed a process, the screen didn't show the one just killed(i mean the system cleared that entry immediately w/o displaying <defunct>) if i entered ps again. why !?
if you want to kill the program you dont need the pid in root. just type killall then the program name killall all together . if i want to stop my dialup program I type killall pppd
thanks:
[root@localhost /]# ps
PID TTY TIME CMD
4662 pts/0 00:00:00 bash
5732 pts/0 00:00:00 yum
5764 pts/0 00:00:00 yum
6854 pts/0 00:00:00 man
6876 pts/0 00:00:00 sh
6878 pts/0 00:00:00 less
6900 pts/0 00:00:00 man
6921 pts/0 00:00:00 sh <defunct>
6923 pts/0 00:00:00 less
6978 pts/0 00:00:00 man
6999 pts/0 00:00:00 sh <defunct>
7001 pts/0 00:00:00 less
7305 pts/0 00:00:00 man
7326 pts/0 00:00:00 sh <defunct>
7780 pts/0 00:00:00 man
7801 pts/0 00:00:00 sh
7803 pts/0 00:00:00 less
7809 pts/0 00:00:00 man
7830 pts/0 00:00:00 sh
7831 pts/0 00:00:00 bzip2
7832 pts/0 00:00:00 less
7838 pts/0 00:00:00 man
7840 pts/0 00:00:00 sh
7842 pts/0 00:00:00 less
7852 pts/0 00:00:00 ps
[root@localhost /]# killall yum
[root@localhost /]# ps
PID TTY TIME CMD
4662 pts/0 00:00:00 bash
5732 pts/0 00:00:00 yum
5764 pts/0 00:00:00 yum
6854 pts/0 00:00:00 man
6876 pts/0 00:00:00 sh
6878 pts/0 00:00:00 less
6900 pts/0 00:00:00 man
6921 pts/0 00:00:00 sh <defunct>
6923 pts/0 00:00:00 less
6978 pts/0 00:00:00 man
6999 pts/0 00:00:00 sh <defunct>
7001 pts/0 00:00:00 less
7305 pts/0 00:00:00 man
7326 pts/0 00:00:00 sh <defunct>
7780 pts/0 00:00:00 man
7801 pts/0 00:00:00 sh
7803 pts/0 00:00:00 less
7809 pts/0 00:00:00 man
7830 pts/0 00:00:00 sh
7831 pts/0 00:00:00 bzip2
7832 pts/0 00:00:00 less
7838 pts/0 00:00:00 man
7840 pts/0 00:00:00 sh
7842 pts/0 00:00:00 less
7856 pts/0 00:00:00 ps
[root@localhost /]#
You shouldn't have to remember 'kill -9', it's the same as 'kill -KILL' and the pid or you can use 'killall -KILL' and program name. If you wanted to kill all instances of yum you would run:
You shouldn't have to remember 'kill -9', it's the same as 'kill -KILL' and the pid or you can use 'killall -KILL' and program name. If you wanted to kill all instances of yum you would run:
Code:
killall -KILL yum
as root.
thanks. it worked, too. i think both kill -9 xxx and killall -KILL name are feasible. however, i still wonder why i just needed to type kill pid under unix w/0 including -9 ???
As mentioned further up, normally
kill <pid>
is sufficient to tell a prog to close GRACEFULLY if you own it or you are root.
For emergencies and or if the prog is 'hung',
kill -9 <pid>
should kill it UNGRACEFULLY ie you risk open/corrupted files, broken sockets etc.
Occasionally you get processes so badly hung that they remain zombies until a reboot. This is rare, but has been known.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.