Prev / Next

2006-11-05 / pgrep, pkill を使用してプロセスを殺す

http://d.hatena.ne.jp/lurker/20061102/1162427170

$ pgrep -f emacs
357
374
$ pgrep -fl emacs
357 emacs
374 /usr/bin/ruby -S migemo -t emacs -i  -u /home/fumi/.migemo-user-dict -d /usr/share/migemo/migemo-dict
$ pgrep -l emacs
357 emacs


"-f" プロセスの引数もマッチ対象にする
"-l" プロセス名を表示

ps ax | grep emacs


とすると,grep emacs のプロセスがひっかかるが,
pgrep では pgrep emacs のプロセス自身がひっかかることはない.

comments powered by Disqus