Custom Search

Sunday, October 18, 2009

Find and Kill Process

I had used the following to find an instance of conky and
kill it in order to start a different conky configuration:

ps -U useracct |grep justweather |head -1 | \
cut -c 1-5 |sed -e ’s/[\ ]//g;/^$/d’ > jwpid.out
kill -9 `cat jwpid.out`

That’s unnecessarily complicated compared to this simpler way:

ps -U useracct |grep justweather.conkyrc | awk ‘{print $1}’ | \
xargs kill -15

Labels: , , , , , ,