This question already has an answer here:

I ran a R console on our server, and the process took much longer time than I expected. Thus I was trying close it by ctrl+z, it didn't work. Finally I just closed the terminal. But the process is still there when I check with top commands. I used kill, but won't kill the process. The top command output:

27448 zhenyang  20   0 20.133g 0.020t 3.840g R 100.0 21.3  72:00.06 R 

I checked the website and someone says it might be ctrl+z put the process in background, but fg command won't work.

Anyone help?

marked as duplicate by Thomas Dickey, GAD3R, Anthon, Anthony Geoghegan, don_crissti Sep 6 '16 at 14:10

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • To kill it: kill 27448. To kill it with fire (i.e. this has unwanted side effects, so try it only if the first version doesn't work): kill -9 27448. – Satō Katsura Sep 5 '16 at 7:23
  • @SatoKatsura, I have tried both, and both won't work. something weird is that "20.133g 0.020t 3.840g", although I don't quite understand the meaning, they are different from other processes. – concer guo Sep 5 '16 at 7:34
  • Is it a process from your user? If you don't care killing every single one of your processes, do the big kill -9 -1 – J. Chomel Sep 5 '16 at 7:38
  • 1
    @JuliePelletier Passing -1 as the process ID kills all the processes of the calling user (of any user if the calling user is root) except init. This is standard behavior. A non-root user cannot crash the machine. – Gilles Sep 5 '16 at 22:50
  • 1
    @J.Chomel Given that the intent is to kill a specific process, there is absolutely no reason to kill all processes with -1. – Gilles Sep 5 '16 at 22:50

Run the command kill and pass it the process ID, i.e. in your case

kill 27448

By default, this kills the process, but if the program has set up a signal handler, it may continue to run. If the process keeps running, use

kill -KILL 27448

(or equivalently kill -9 27448). The KILL signal cannot be caught, it always kills the process. (Maybe not immediately if the process is doing some long input/output, but it does kill it.)


CTRL+Z does not kill processes, it suspends their execution (aka it stops them). It does this by sending the TSTP signal to the process which can be resumed by sending the CONT signal to the process.

kill -CONT <pid>

Once suspended the processes won't respond to other nice signals like TERM (which is what kill sends by default) until the process is resumed with the CONT signal - at which point it will process all pending signals immediately. The exception to this is the KILL signal which immediately kills the process without giving it a chance to end gracefully.

kill -KILL <pid>

This is generally discouraged as it will skip any teardown/cleanup the process normally does. Instead of CTRL+Z you should use CTRL+C to ask the foreground process to end. This sends the INT signal to the process which generally (not always) has similar behaviour to the TERM signal - it asks the process to end gracefully.

You can read more about linux/bash process job control here.

Not the answer you're looking for? Browse other questions tagged or ask your own question.