Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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:


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 '14 at 5:56
@CMCDragonkai You've hit a situation where the command you've run is now owned by a different user because you used sudo, so you can't kill it, but running kill using sudo means you no longer have access to your user's job list (try running sudo jobs to see what I mean). Instead, since you now have the PID, simply run sudo kill 3593. – morloch Mar 25 '15 at 21:36
How can a backgrounded process be owned by another user? – CMCDragonkai Mar 26 '15 at 12:11

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .