Click to See Complete Forum and Search --> : Kill a running program in console mode?


tomg3k
12-11-2002, 10:48 PM
I'm new to linux, and right now I've got an old PC that I have it running on without a GUI (it's going to eventually be a server). My question is this: how do you kill a running program if it's doing a task? For example, sometimes I run a program if I'm curious as to what it is, and what happens often is that it will give some text, and then have the little _ blink, which I assume means the computer is processing information and for me to wait. But sometimes whatever task I'm telling it to do when I run a program takes forever to finish, and I'm wondering if there is any way to stop just that program when it doesn't give me the option to do anything. Similar to Ctl+Alt+Del in windows, but not shutting down the computer.

Hopefully I'm being clear. Thanks.

trilarian
12-11-2002, 11:04 PM
If you are using a gui, "gtop" is similar to windows with the ctrl-alt-del. If you are in a term do "ps -A" for all processes. If there are to many, you can pipe it with "ps -A | grep searchword". Then notice the number to the far left. To stop that process type "kill -9 processnumber". If you are running a program in terminal and you can't get a propmt back hit "ctrl-z" to get to prompt, then "bg" to send it to the background. This way you can still type. If you want to kill background process type "jobs" then notice what number the job is you want to kill. Type "kill %job#".

Hope it helps.

bskahan
12-11-2002, 11:21 PM
the command top works on the command line as well.

tomg3k
12-12-2002, 01:25 AM
Thanks!

camelrider
12-12-2002, 09:01 AM
If you're running a program from the command line and it hasn't returned you to a prompt you can stop that program by typing <ctl+c>