LoginSignup
1
2

More than 5 years have passed since last update.

CPU使用率が何パーセント以上のプロセスをkillするみたいなの

Posted at

CPU使用率が何パーセント以上のプロセスをkillするみたいなの

ps auxwww | sort -k3 | grep '[PROCESSNAME]' | tail -n3 | awk '{if($3>[何パーセント]) print $2}'

これで抽出される。

例)

ps auxwww | sort -k3 | grep -w '^hogeuser' | tail -n3 | awk '{if($3>30) print $2}' | xargs kill

hogeuserがオーナーの上位3つのCPU使用率が30%以上のプロセスをkill。
凶暴なコマンドなので常用はおすすめしません。

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2