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)

4 Answers 4


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.


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.

  • 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.
    – DQdlM
    Dec 11, 2012 at 19:51
  • 1
    if you type top -U yourusername in terminal, it'll list only the process that you are using. Dec 12, 2012 at 3:25
  • awesome! +1 just for that! thanks
    – DQdlM
    Dec 12, 2012 at 14:59
  • while in top, hit k then 15 for a soft-kill (try first), 9 for a hard-kill. Dec 25, 2012 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.


Too easy and not the answer to doing this from shell. But for all of those who are fine with a "workaround":

I switched to that other terminal window that needed to be closed and clicked on "X". It told me that this would kill the process and asked if I really wanted that. Yes. That was all I needed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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