Grep and special files

Sometimes, you may wondering why a simple grep -R /my/path suddenly stalls, without any blatant reason nor disk activity.

First thing to do (after having nervously restarted the command of course ;-)) : check the process state with ps:

$ ps -uwp 2821
USER   PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
loic  2821  0.1  0.0  13368  3148 pts/2    S+   18:22   0:00 grep -R cfe.png /srv/

The STAT column is interesting here, because it gives the process status (man ps)

Read more...