長時間かかる処理を動かした時や別のWindowが開くプログラムをターミナルから立ち上げたけど、後からバックグラウンドに切り替えたい時の対処方法。
-
Ctrl+z
で処理を一時停止する -
bg
[background]コマンドで処理をバックグラウンドに移す - バックグラウンドで処理中のプロセスを確認する時は
jobs
を使う。
ちなみにffmpeg でエンコード中に一旦止めて再開したらちゃんと続きからエンコードしてくれましたが、バックグラウンドで処理中も処理内容をずっと画面に吐き出し続けてくれるのでまともにCUIで作業することはできませんでした。
もうちょっと出力の少ないプログラムを動かしてる時に使いましょう。
ちなみにこの bg
とかjobs
とか fg
などはbash限定のコマンドらしくマニュアルが見たい場合は man bg
とかではなく man bash
して "bg" などで検索してください。
もしくは help bg
してください。コメントで指摘いただきました。こちらの方が一般的な方法です。
参考
ITmedia エンタープライズ : Linux Tips「現在動作中の処理(ジョブ)をバックグラウンドに回したい」
http://www.itmedia.co.jp/help/tips/linux/l0179.html