linux下查看进程存不存在: 517 ~>ps -elf|grep -w ‘cron’|grep -v grep 5 S root 3179 1 0 80 0 - 925 hrtime 09:02 ? 00:00:00 /usr/sbin/cron 下面这个比较巧妙: 518 ~>ps -efl|grep -w [c]ron 5 S root 3179 1 0 80 0 - 925 hrtime 09:02 ? 00:00:00 /usr/sbin/cron ps时会出现grep这个进程,看下面的: 1: grep cron => “grep cron” 2: grep [c]ron => “grep [c]ron” 但是grep cron 和 grep [c]ron 的实际效果都是查找cron这个字符串 很明显的只有1的时候会把grep本身给找出来。