Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

This is probably a frequently asked question, but I've been unable to find good documentation.

I have jobs running on my system:

foo@fooBox:~/tmp$ jobs
[1]+  Stopped                 foo bar baz

How can I kill this process? I've tried various commands, like kill 1, but it hasn't worked.

share|improve this question
    
alternatively, $fg [enter] [ctrl-c] :p –  bubu Feb 24 '11 at 4:00
    
@bubu: That won't work for some programs that catch SIGINT, such as vim. –  Wuffers Feb 24 '11 at 13:24
    
@Mark Szymanski I knew, I knew :p –  bubu Feb 24 '11 at 15:23

2 Answers 2

You can use the method suggested by @fideli, or you can use the kill command like so:

kill %1

This will kill the first suspended command. You can also find a list of suspended commands like so:

jobs

and it will provide output like such:

[1]+  Stopped                 yes

If you have multiple stopped jobs, the number in brackets ([1]) will be the job number, the one you provide after the % in the kill command.

share|improve this answer
    
This is great! Learned something new about kill. –  fideli Feb 24 '11 at 6:31
    
How come I get this -bash: kill: (3593) - Operation not permitted. When I use it with sudo, I get this kill: %1: invalid process id –  CMCDragonkai Jul 13 at 5:56

If you run ps ax you will get a list of all processes running. Look for the one you want to kill and note the number in the PID column. E.g. say the number was 10203, you would then run:

kill 10203

You can also run ps ax | grep foo to find the exact program you're looking for. Finally, you could run:

killall foo

to kill all instances of foo.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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