6

I ran cat /dev/zero and it now just hangs whenever I run a cat command. I pressed Ctrl+C to stop that command.

Have I broken something, and how can I fix it?

Tim
  • 32,274
  • 27
  • 118
  • 177
  • Have you made sure that you have killed all `cat` processes? –  Jul 03 '15 at 19:32
  • I have, but I think that someone has posted a better answer to mine. –  Jul 03 '15 at 19:52
  • Tim, After pressing `Ctrl + C` did `cat` stop ? It should work.. – heemayl Jul 03 '15 at 20:07
  • Hmmm..interesting..should work..tested it to be sure..working for me..were you able to use the same shell again after pressing `Ctrl + C` ? – heemayl Jul 03 '15 at 20:10
  • 1
    @heemayl yeah, I was this time :/ now im confused. I guess I panicked and it was actually fine. :P – Tim Jul 03 '15 at 20:11

2 Answers2

5

/dev/zero returns infinitely 0-bytes. The process will never end.

You need to identify the cat process and kill it with for example pkill:

pkill -f 'cat /dev/zero'
Sylvain Pineau
  • 61,564
  • 18
  • 149
  • 183
2

This is likely to be caused by the cat process failing to exit, so to remedy the situation you should make sure that you have killed all cat processes.