1

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

cat /dev/random

3
  • Why are you typing cat /dev/random?
    – Daniel
    Sep 16, 2012 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) Sep 16, 2012 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, 2012 at 18:55

2 Answers 2

4

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).

5
  • Is "kill -9" a joke referring to 9 lives of a cat, or is it something else? Sep 16, 2012 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.
    – nohillside
    Sep 16, 2012 at 14:37
  • Would killall cat not work?
    – segiddins
    Oct 3, 2012 at 14:41
  • 1
    There might be several cats running through the (process) jungle, no reason to commit felinicide...
    – nohillside
    Oct 3, 2012 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. Nov 22, 2012 at 1:11
1

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

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .