Friday, March 27, 2009

afk




kill -0. Neat, it's a way to see if a process exists:


chris@chris-laptop:~$ sleep 60 &
[1] 1316
prompt:~$ kill -0 1316 # process id of the sleep command
prompt:~$ echo $?
0
prompt:~$ kill -0 65535 # process does not exist
bash: kill: (65535) - No such process
prompt:~$ echo $?
1
prompt:~$ sudo kill -0 27835 # a kernel process
prompt:~$ echo $?
0