cancel
Showing results for 
Search instead for 
Did you mean: 

Clearing a stuck program

Community Veteran
Posts: 1,369
Thanks: 33
Registered: 07-03-2008

Clearing a stuck program

Hi folks,
Having had a frozen display using OOo Impress to display an emailed slide show, I was uncertain how to get rid of it . Being an escapee from Gates-bloat, I missed the trick of Ctrl+Alt+Delete to get back to sanity (?). The books do not show any similar key combination to do much the same thing in Hardy. I resorted to shut-down using the power button on the laptop pressed for a few seconds. I was delighted to see that did not appear to screw anything up on a later restart, having visions of much destruction as a result of such drastic action. Any ideas out there?
colintivy  Roll eyes
8 REPLIES
Community Veteran
Posts: 1,850
Registered: 11-08-2007

Re: Clearing a stuck program

ctrl-esc should bring up ksysguard, if you use kde.  scroll down to the offending prog and zap it.  alternatively, open a console and type top.  this will show the running processes.  look for the pid of the prog and kill it.
one of my favourites - and the most dangerous - is ctrl-alt-esc.  this will bring up a skull and crossbones, which will kill whatever you click on instantly.  care needs to be used with this command as it is all too easy to kill the desktop without meaning to.
MrC
Grafter
Posts: 523
Thanks: 2
Registered: 17-07-2008

Re: Clearing a stuck program

@artificer: being Linux there's lot's of ways to do this. colintivy has shown a few here's a few more:-

  • Go to a shell prompt (either by starting a graphical console like konsole, xterm, rxvt or gnome-terminal from your desktop menus or by using Ctrl-Alt-<number> to switch to a virtual console if you were running the slideshow full screen. To then kill all openoffice processes type:-
    mike@lucy ~ $ killall -9 soffice.bin
    To identify and kill a specific impress openoffice instance rather than all openoffice processes:-
    mike@lucy ~ $ ps -ef|grep -i impress
    mike    16814    1  9 17:12 pts/1    00:00:01 /usr/lib64/openoffice/program/soffice.bin -impress -splash-pipe=5
    mike    16837 11880  0 17:12 pts/1    00:00:00 grep --colour=auto -i impress
    mike@lucy ~ $ kill -9 16814

  • From the aforementioned shell prompt run xkill and follow the prompt:-
    mike@lucy ~ $ xkill
    Select the window whose client you wish to kill with button 1....

  • If you were running impress in a normal desktop window (ie not full screen) then click the normal kill window icon (normally a cross) in the top right hand corner of the window. If the window doesn't close itself after a few seconds the window manager will usually ask you if you want the process killed manually (just like Windows).

  • You can kill the current X session completely by pressing Ctrl-Alt-Backspace. This will kill your desktop but you should then be able to login again without rebooting the PC


Mike
VileReynard
Seasoned Pro
Posts: 10,651
Thanks: 206
Fixes: 9
Registered: 01-09-2007

Re: Clearing a stuck program

On a related note, if the "stuckness" is due to a looping program, you can (at least in Ubuntu Smiley )
Press CTRL+ALT+F1 where F1 - F6 are equally acceptable.
sign on.
use the command "top" to identify CPU hogs
press CTRL-C
Then type kill PID where PID is the process identifier - from the "top" command.
If you don't own the process use sudo kill PID
Switch back to your GUI with CTRL+ALT+F7
Do not use CTRL-ALT-DLT - it's a last resort to reboot your PC - it will try to shut down semi-cleanly, but you will lose data. (see below).
BEFORE you do this, use the sysreq key [not shown on many keyboards!!!]
On mine it's PrintScreen  Smiley
Go to the CTRL+ALT+F1 screen
Press Sysreq+S - this will force data in buffers etc to be forced  out to disc.
For more Sysreq options see http://www.linuxhowtos.org/Tips%20and%20Tricks/sysrq.htm
If things are not too bad you can do quite a lot by restarting your GUI (and X) with CTRL+ALT+BACKTAB
This will restart your desktop in a moderately nice way.

Community Veteran
Posts: 1,369
Thanks: 33
Registered: 07-03-2008

Re: Clearing a stuck program

Hi folks,
What a welter of information you dug up on your days off!!!
In my case the presentation display, which was full screen, stuck doing what it had been doing but there was no mouse cursor visible, which left me with only keys to play with to alter anything. Therefore I did try the Windows method (Ctrl+Alt+Del)which was the only one I knew about but it appeared to do nothing. Options to get into command line etc., seem to be not on with no apparent to get to the terminal. Ctrl+Esc would be OK but I am not using kde but Ctrl Alt F1 sounds promising.I think that I will print this lot out as a reference in future need, much too much to absorb in one go. Thanks a bundle.
colintivy  :-)
Community Veteran
Posts: 1,850
Registered: 11-08-2007

Re: Clearing a stuck program

ctrl-alt-backspace will usually restart x, taking you back to login.  occasionally linux gets completely stuck and the only way out is to hold the power button.  a reset is slightly less brutal, if you have a reset button.
VileReynard
Seasoned Pro
Posts: 10,651
Thanks: 206
Fixes: 9
Registered: 01-09-2007

Re: Clearing a stuck program

Make sure that all your file systems are journalised before a reboot Cheesy
i.e. no ext2 / FAT / NTFS(?) file systems mounted.

Ben_Brown
Grafter
Posts: 2,839
Registered: 13-06-2007

Re: Clearing a stuck program

Quote from: Axis

sign on.
use the command "top" to identify CPU hogs

Or my favourite:

ps -eo pid,pcpu,args | sort -nk2 | tail

This will give you the top 10 cpu using programs in ascending order (worst offender at the bottom). If you're crazy and want to kill the biggest hog without caring what it is (NOT recommended) you could do:

ps -eo pid,pcpu | sort -nk2 | tail -n 1 | awk '{print $1}' | xargs kill -9

Just because you can do it doesn't mean you should tho Wink
Waldo
Grafter
Posts: 473
Registered: 01-08-2007

Re: Clearing a stuck program

Quote from: Ben


ps -eo pid,pcpu,args | sort -nk2 | tail

This will give you the top 10 cpu using programs in ascending order (worst offender at the bottom).

Eeek! Six of my top 10 CPU hogs are the six instances of gkrellm I have running (one on each virtual desktop).
At 1% CPU, according to top, I think I'll let them live..... Roll eyes