-   Linux - Newbie (
-   -   Killing the process on a virtual terminal from another virtual terminal. (

Azazwa 05-04-2009 06:46 AM

Killing the process on a virtual terminal from another virtual terminal.
Hi !

I used 'top' in a terminal, but it is not responding, and I can't seem to quit by using 'q'. I could open another virtual terminal (CTRL+ALT+F2)and log in as a different user, and I would like to kill the process in the other terminal, but I don't know how to get the pid of that terminal. Can I search for processes begun by a certain user? How do I do that?


your_shadow03 05-04-2009 07:07 AM

ps -auxf | grep "<processname>

mark_alfred 05-04-2009 08:17 AM

Why worry about the pid? Just enter "killall top" (without quotes).

Azazwa 05-04-2009 08:37 AM


I used (as root) ps -u user1 to get the pid's of the processes run by the user1, which I thought included the top process that seems to "hang". When I went back to the first virtual terminal, it didn't change anything. It's still hanging. Then I saw mark afred's reply, and tried "killall top", but it says "top: no process killed". I wanted to check files that I copied over with the network, so (as root) I tried "cd /", and then "ls", but now it hangs at the "ls" part, and doesn't give anything. I'm now as root on the third virtual terminal, but I'm afraid of running out of terminals, so to speak. I don't know what's going on.

Anyone got an idea?

mark_alfred 05-04-2009 10:23 AM

Maybe "killall -u user1", which should kill all processes being run by user1, or "killall -u user1 top" to specifically kill the process of top being run by that user.

Rebooting often works, if all else fails.

Additional thought:
When you say "virtual terminal" are you in xwindows, using a terminal emulator like gnome-terminal or xterm? Perhaps pressing Ctrl-Alt-F2 (the three keys in combination), and opening a new terminal, signing in as user1, rather than as a different user as your first post pondered, and then killing the process from there, might work.

ozminh 05-04-2009 11:00 AM

i'll kill them all ('kill -9 -1').

Azazwa 05-05-2009 04:37 AM

Thanks everyone!

I'm also thinking that that specific user that I was trying to log in as on the node doesn't yet exist on the node, although it is very queer in and of itself, but I won't go into the detail of that.

However there was a 1 second power-cut late yesterday afternoon, so for now, I'll worry about the login problems at a later stage.


Azazwa 05-05-2009 06:55 AM

Oh, may I say, I tested your advice with another problem.
I pinged another host without using "-c1" and I didn't know how to stop it, so I used the ps -auxf | grep <processname> and kill "pid" which was 9256 or something from another terminal (CTRL+ALT+F2), but I guess it could also just have been killall ping.

Poetics 05-05-2009 12:33 PM

Remember that you can (almost) always also use Ctl-C to stop commands (especially useful in the cases such as ping).

All times are GMT -5. The time now is 02:24 PM.