nice
プロセスとシステム
書き方
nice -n <19..-20> <command>CPU の優先度を下げてコマンドを始めます。値は 19(最も譲る)から -20(最も欲張り)までで、負の値は root だけ、効くのはディスクではなく CPU だけです(ディスクは ionice)。
よく使うオプション
| オプション | 意味 |
|---|---|
| -n 19 | Lowest priority: yields the CPU to everything else. |
| -n 10 | What you get if you run nice with no -n at all. |
| -n -5 | Higher priority than normal. Negative values need root. |
例
nice -n 19 tar -czf backup.tar.gz /dataCompress a big directory without slowing down the rest of the machine.
sudo nice -n -5 ./latency-sensitiveGive a process more CPU priority than normal.
何が動いていて何が資源を食っているかを見ます。止める前に何なのかを確かめるのが順番です。
読み方
- 角括弧 [ ] は省いてよい部分です。
- 三点 … は複数並べられるという意味です。
- オプションは大文字小文字を区別します — -r と -R が別物のコマンドもあります。
よくある質問
Q. nice は何をしますか。
CPU の優先度を下げてコマンドを始めます。値は 19(最も譲る)から -20(最も欲張り)までで、負の値は root だけ、効くのはディスクではなく CPU だけです(ディスクは ionice)。
Q. どう打ちますか。
nice -n <19..-20> <command> — 角括弧は省いてよい部分です。
Q. よく使うオプションはいくつですか。
ここにまとめたのは3個です。全部は man nice にあります。このコマンドはプロセスとシステムの仲間です。
関連するコマンド
man ページ: man nice