kill - Send a specified signal to a process or process group.
76
votes
11answers
33k views
What if 'kill -9' does not work?
I have a process I can't kill with kill -9 <pid>. What's the problem in such a case, especially since I am the owner of that process. I thought nothing could evade that kill option.
20
votes
3answers
3k views
why not kill -9 a process?
I am always very hesitant to run kill -9.
But I see other admins do it almost routinely.
I figure there is probably a sensible middle ground.
So:
When should kill -9 be used?
What should be tried ...
19
votes
2answers
1k views
why would typing Ctrl+c twice stop a running process in Linux?
There are Linux programs, for example vlc, that recommend typing ctrl+c twice to kill their execution from a terminal if the program didn't stop after the first one.
Why would typing ctrl+c twice ...
19
votes
2answers
367 views
When you try to terminate a process for good, which option for “kill” should you use?
I am getting a lot of mixed messages from people, and was wondering if it there really is not much of a difference in what you use.
kill 'x'
killall 'x'
kill -9 'x'
These are some options I've been ...
16
votes
1answer
492 views
How does systemd survive a kill -9?
Between the recent "Why does 'kill -9 0' end my console session" and "How to get a kernel panic" questions, I got a bur under my saddle and tried kill -9 1 on a mostly up-to-date Arch linux laptop. I ...
13
votes
5answers
1k views
Any way to restart a Linux machine via SSH if the root filesystem is not working?
Just as a curiosity; something went wrong with a Linux machine, making the root file system show up as "64Z". A few commands work, like top, df, and kill, but others like reboot come up with "command ...
13
votes
3answers
957 views
How to kill a process with a single command?
I want to kill a process, after finding the id in a single step.
I currently use these two commands:
pidof <name>
kill <#number_which_is_result_of_command>
How can I write a single ...
13
votes
5answers
4k views
How can I close a terminal without killing its children (without running `screen` first)?
sometimes I run an app in the gnome-terminal, but then I suddenly have to restart gnome or something. I guess the answer to the question is also useful then I want to disconnect from SSH where ...
11
votes
2answers
828 views
Is '-9' a flag to kill command?
What does -9 do?
It does not show up in the syntax:
$ kill
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
$
11
votes
3answers
416 views
How Can Terminal Emulators Kill Their Children After Recieving a SIGKILL?
From what I understand, SIGKILL cannot be caught. This would imply that a process does not have time to kill it's children before the OS destroys it. This can be demonstrated with a shell script.
...
10
votes
2answers
378 views
Why does bash show 'Terminated' after killing a process?
Here is the behaviour I want to understand:
$ ps
PID TTY TIME CMD
392 ttys000 0:00.20 -bash
4268 ttys000 0:00.00 xargs
$ kill 4268
$ ps
PID TTY TIME CMD
392 ttys000 ...
10
votes
3answers
6k views
Where can I see a list of kernel killed processes?
Is there some way I can check which of my processes the kernel has killed? Sometimes I log onto my server and find that something that should've run all night just stopped 8 hours in and I'm unsure if ...
10
votes
3answers
8k views
How can I kill a <defunct> process whose parent is init?
Transmission is intermittently hanging on my NAS. If I send SIGTERM, it doesn't disappear from the process list and a <defunct> label appears next to it. If I send a SIGKILL, it still doesn't ...
10
votes
2answers
479 views
Is there an upper limit to the number of zombie processes you can have?
I used to work with an HP-UX system and the old admin told me there is an upper limit on the number of zombie processes you can have on the system, I believe 1024.
Is this a hard fact ceiling? I ...
9
votes
6answers
5k views
pgrep and pkill alternatives on mac os x?
Are there alternatives to pgrep and pkill commands on Mac OS X or should I just create aliases for them using other commands available for me?
7
votes
5answers
1k views
How to soft kill gui applications via terminal?
Is there a way to close a GUI application in friendly "please quit yourself now" way, without graphical access to the applications window?
For example, if Gnome/X display crashes to black, I'd like ...
7
votes
3answers
570 views
How to stop a bunch of processes on unix fast?
How to stop a bunch of processes on unix fast.
I can use ps/top, kill.
If the number of processes is very large, I use shell script.
Are there other ways, only one or two unix commands can do it ...
7
votes
2answers
2k views
How to kill both process and subprocess?
I asked a question to know how to get multiple lines of message from Python's subprocess module.
The problem is that in the course of testing, I had to kill the python process that runs gnuchess ...
7
votes
1answer
331 views
Interrupt sequence CTRL+C does not work for user
In any terminal operating under GNOME, if I press Ctrl+C, I only see a question mark. Same goes for Ctrl+Z. The output of stty -a | grep intr is:
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ...
6
votes
1answer
242 views
Why does “kill -9 0” end my console session?
I just wonder why kill -9 0 ends my tty console session?
What exactly is PID 0, it is not listed on a ps aux?
6
votes
2answers
120 views
Decode Flags for Kill Command
I am new to Shell Scripting.
I saw this Command on a Book for Linux shell Scripting
$ kill -HUP 1234 >killout.txt 2>killerr.txt
I know what the command does, but i am not able to understand ...
5
votes
4answers
204 views
Accidental `nano SomeFile | uniq` renders the shell unresponsive
In my attempt to get unique entries (read lines) out of a simple text file, I accidentally executed nano SomeTextFile | uniq.
This "instruction" renders the shell (bash) completely (?) ...
5
votes
4answers
1k views
Finding the ID of a process and killing it
When ever I need to kill a background process I do ps -e | grep <process_name>
Which prints something like this 1766 ? 00:00:13 conky , Then I use the process ID to kill it like so kill 1766 .
...
5
votes
3answers
1k views
How to make `xargs` ignore child's exit and keep processing further
I sometimes run long xargs jobs overnight and it is really annoying to discover in the morning that xargs died somewhere in the middle, for example because of a segmentation fault in one single ...
5
votes
3answers
299 views
What did I just kill?
Is there any way to find out what I just killed?
$ ps -A -o pid,cmd | grep someApp | grep -v grep
2802 python someApp.py
$ sudo kill 2302
$
EDIT: To clarify, I need to know what PID 2302 was before ...
5
votes
2answers
1k views
killall gives me `no process found ` but ps
Could somebody explain to me the difference between kill and killall? Why doesn't killall see what ps shows?
# ps aux |grep db2
root 1123 0.0 0.8 841300 33956 pts/1 Sl 11:48 0:00 ...
5
votes
4answers
3k views
'kill java' doesn't kill java
I am running debian right now and sometimes I need to kill java manually from the terminal, but when I try kill #pid# or pkill java nothing happens. No console output (ok, that's normal) and java is ...
5
votes
3answers
1k views
How can I kill and wait for background processes to finish in a shell script when I Ctrl+C it?
I'm trying to set up a shell script so that it runs background processes, and when I Ctrlc the shell script, it kills the children, then exits.
The best that I've managed to come up with is this. It ...
5
votes
3answers
2k views
How to kill a daemon with its name gracefully?
I usually kill a process with killall.
killall markdoc
But I can't sure this command terminates the process gracefully.
Does this command graceful termination? If it's not, how can I kill a ...
5
votes
2answers
398 views
kill -9 hangs, unable to kill process (murder proof process) [duplicate]
Possible Duplicate:
What if ‘kill -9’ does not work?
I guess its a bit late to ask this, but for future reference;
I was called to look at a server today after a customer was reporting ...
5
votes
1answer
237 views
`kill -s TERM` works, `kill -s ABRT` gets “Operation not permitted”
There is a process that I own whose documentation claims I can send SIGABRT to in order to get some debugging information. However, when I try to send SIGABRT, I get back "Operation not permitted".
I ...
5
votes
1answer
281 views
Enable kill X.org with an own key combination
I've just read Enable kill X.org with ctrl+alt+backspace and am really happy, that control-alt-backspace no longer kills my X-Server. However, I'd like to have a way to kill it; it just should be ...
4
votes
3answers
928 views
How to kill two or more processes with one kill command?
I am using the following command to kill one java process via shell script:
pidof java|xargs kill -9 $1
What if the list of pidof output has more than one elements? How do I kill them both with ...
4
votes
6answers
877 views
Kill many instances of a running process with one command
This is one of the questions that has troubled me often. Suppose I have thousand or more instances of any process(for e.g. say the process vi) running. How do I kill them all in one single shot/one ...
4
votes
2answers
2k views
How to pkill by “command name”?
So I'm executing a command like:
COMMANDNAME -PARAMETERS
But..why can't I kill it with "pkill"? I'm trying with:
pkill -9 "COMMANDNAME -PARAMETERS"
but it doesn't kills the "COMMANDNAME ...
4
votes
3answers
877 views
Linux: Kill process based on arguments
How can I kill a process based on its command line arguments?
killall, pgrep, and pkill seem to only work based on the process name.
I need this to be able to differentiate between a number of ...
4
votes
1answer
41 views
Suspend and edit previous single line commands
Say I want to modify the latter of some concatenated command line options, is it possible without killing the first command?
Specifically I have compile and run scripts executed thusly:
> compile ...
4
votes
2answers
104 views
How to kill a process giving it a number of seconds before a doing the forced kill?
I do have the PID of the process to be killed but I do want to give it the chance to die peacefully, without doing a -9.
Expected behaviour: check if PID is still running for up to ten seconds and do ...
4
votes
1answer
53 views
Kill user processess on logout
I have a Ubuntu server that handles remote X sessions from users. However, I don't want to allow users to run any kind of background processes - so here is my question:
How do I prevent users from ...
3
votes
2answers
2k views
Program behavior when kill -HUP is recieved?
Is there a way to find out what will program do when it receives kill signal HUP?
Without simply running the command ofc :D
For example,
killall -HUP pppd will restart pppd
killall -HUP firefox ...
3
votes
2answers
584 views
closing unused gnome terminals
while working I start lots of gnome-terminals and do something with them. dd on first terminal, 12 ssh sessions to a bunch of servers to do something. These sessions are finishing it's job and get ...
3
votes
2answers
585 views
Exit Google Chrome from terminal
Is there a way to cause google-chrome to quit, from the terminal, besides using killall google-chrome?
I would like to be able to close it from a script without killing it.
3
votes
1answer
145 views
What is the difference between exiting a process via Ctrl+C vs issuing a kill -9 command?
I know I can kill any process with kill -9 command . But sometimes i see that even if I have terminated a program with CTRL+C , the process doesn't get killed . So I want to know the difference ...
3
votes
2answers
1k views
Killing multiple GNU screen sessions with the same name
Sometimes my script bugs out and multiple screen sessions with the same name get created. Is there a way to kill all of these with this name in one command?
Rx:/scripts# screen -S haydoz-script -X ...
3
votes
3answers
34 views
Print process ID (PID) of a Matlab instance
To run my Matlab scripts, I've created a shell script to which I give two parameters - the path to the matlab file ($1) and to the log file ($2):
nohup time matlab -some_parameters -r "run $1;exit" ...
3
votes
2answers
276 views
Why is `sudo pkill -HUP -f “nginx: master process”` returning code 129 and no output
I'm trying to trigger a reload of the Nginx master process by using pkill and sudo.
The server reloads fine, but I was just curious if anyone knows why the command sudo pkill -HUP -f "nginx: master ...
3
votes
2answers
462 views
How can I kill the top CPU/IO process quickly?
I find that sometimes my Linux will stop responding, so I need to switch to another terminal with CtrlAltF2, and type a command to kill the top CPU usage process or top IO usage process, so that the ...
3
votes
1answer
179 views
Cannot kill a java process
I have a java process that cannot be killed. I have tried every method I know, or that I have found on the internet to no avail. I have tried:
killall java
kill -9 <pid>
kill -11 <pid>
...
3
votes
2answers
498 views
Terminate Root Processes
Is there a way to terminate a root process without entering an administrator's password?
You might be wondering why I'd want to do this 'cause it sounds fishy. Well I just need to end a process ...
3
votes
3answers
199 views
Kill process when it stops to produce further output
Is there a shell tool which can probe if a subprocess is still producing output, and otherwise kill it after a specified timeout?
I'm using offlineimap for Gmail backup, but that's very very very ...
