Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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

If I begin a process and background it in a terminal window (say ping google.com &), I can kill it using kill %1 (assuming it is job 1).

However if I open another terminal window (or tab) the backgrounded process is not listed under jobs and cannot be killed directly using kill.

Is it possible to kill this process from another terminal window or tab?

Note: I am using the Xfce Terminal Emulator 0.4.3 and bash (although if a solution exists in another common shell but not bash I am open to that as well)

share|improve this question
up vote 6 down vote accepted

Yes, all you need to know is the process id (PID) of the process. You can find this with the ps command, or the pidof command.

kill $(pidof ping)

Should work from any other shell. If it doesn't, you can use ps and grep for ping.

share|improve this answer

If you type top in the another terminal window, it'll list the all the process running. Note the process id of your job there, Then press q to leave that screen. Then kill the process as usual.

share|improve this answer
thanks for your answer but top does not appear to show all the specific processes running in the shell (e.g., it doesn't show ping). It does give me a PID for the terminal emulator but that kills the terminal emulator as you would expect. – KennyPeanuts Dec 11 '12 at 19:51
if you type top -U yourusername in terminal, it'll list only the process that you are using. – arthankamal Dec 12 '12 at 3:25
awesome! +1 just for that! thanks – KennyPeanuts Dec 12 '12 at 14:59
while in top, hit k then 15 for a soft-kill (try first), 9 for a hard-kill. – Michael Durrant Dec 25 '12 at 4:01

I usually do something like this:

ps aux | grep $PROCESS | grep -v grep | awk '{print $2 " " $11}'

For example, if $PROCESS="bash", then this is the output from my current session:

2683 bash
4481 bash
5695 bash

Then I would kill $PID for whichever /bin/bash I no longer want to be running.

ps, grep and (optionally) awk are helpful for hunting down PIDs to kill.

share|improve this answer

Your Answer


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.