Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

What are the ways I can regain control over my computer when I have terminal in full screen mode and type:

cat /dev/random

share|improve this question
    
Why are you typing cat /dev/random? –  Daniel Lawson Sep 16 '12 at 3:57
    
@DanielLawson - I'm learning OSX and experimenting. I hope to learn how to recover from a runaway process, which may happen in a developer environment (which I'm in) –  makerofthings7 Sep 16 '12 at 4:06
1  
You can press the power button and hold it. The filesystem is journaled and you'll soon learn which programs don't save their files cleanly :-/ –  bmike Sep 16 '12 at 18:55
add comment

2 Answers

up vote 4 down vote accepted

If you have Terminal.app open anyway (doesn't matter whether it's in fullscreen mode or not):

  • Cmd-T to create new tab/shell
  • ps aux | fgrep /dev/random to find the running cat (you can grep for cat as well but there might be more than one matching line)
  • kill <PID from above> (or kill -9 <PID>)

Just be patient, the system may be really slow (even on a multicore system as I've just found out).

share|improve this answer
    
Is "kill -9" a joke referring to 9 lives of a cat, or is it something else? –  makerofthings7 Sep 16 '12 at 14:35
    
See man kill, -9 is the signal to send. By default, kill sends a "soft" termination (letting the application/command handle the termination itself). This may not work if the application is stuck in some loop and never gets to handle the signal. -9 terminates on OS level. –  patrix Sep 16 '12 at 14:37
    
Would killall cat not work? –  segiddins Oct 3 '12 at 14:41
1  
There might be several cats running through the (process) jungle, no reason to commit felinicide... –  patrix Oct 3 '12 at 14:50
    
@makerofthings7 In general, you should at least try kill -TERM or kill -INT (which is the same as ^C) first; jumping straight to SIGKILL is often a bad idea. –  Blacklight Shining Nov 22 '12 at 1:11
add comment

Just tested this, type control-c in terminal, it should stop any running command.

share|improve this answer
    
Perhaps the keyboard buffer was still full for me... ctrl c had no effect –  makerofthings7 Sep 16 '12 at 4:05
    
Really! I tried several times, and each time I was able to get out of 'cat' no problem. –  segiddins Sep 16 '12 at 4:06
    
I ended up going into activity monitor and killing the cat. Fortunately I only had to do it once –  makerofthings7 Sep 16 '12 at 4:08
    
Fair enough. Seems like a strange thing to do, but I've seen (much) worse before. –  segiddins Sep 16 '12 at 4:10
    
You might need to reset the terminal with command-R. –  lhf Sep 16 '12 at 14:43
add comment

Your Answer

 
discard

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.