- #!/bin/sh
- while true
- do
- ps ax -o command | sort | uniq > 1.txt
- usleep 100000
- ps ax -o command | sort | uniq > 2.txt
- diff 1.txt 2.txt | grep '^\\+[^\\+]' | while read a
- do
- a=`echo ${a#*+}`
- if [[ "$a" != "uniq" ]] && [[ "$a" != "sort" ]] && [[ "$a" != "" ]]
- then
- echo $a
- fi
- done
- done
- //该片段来自于http://www.codesnippet.cn/detail/020720149895.html
来源: http://www.codesnippet.cn/detail/020720149895.html