0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

[Linux][command] プロセス管理_ジョブ管理_jobs, &, fg, bg

Last updated at Posted at 2025-03-31

jobs

$ jobs [オプション]
オプション 由来 説明
default job control - 現在のシェルで管理されているバックグラウンドジョブと停止中ジョブの一覧を表示
-l list with PID - 各ジョブのジョブ番号に加え、プロセスID(PID)も表示
-p print PID only - 各ジョブのプロセスIDのみを表示
$ jobs
[1]-  Running                 ./backup.sh &
[2]+  Stopped                 ./longtask.sh
表記 意味
- 直前のジョブ
+ 現在のジョブ
Stopped 一時停止中
Running 実行中

&

# updatedb &
コマンド例 説明
updatedb & updatedb コマンドをバックグラウンドで実行します。シェルは即座に次の入力を受け付けます。

fgコマンド

# fg
# fg [ジョブ番号]
コマンド例 説明
fg カレントジョブ(最後に停止またはバックグラウンドになったジョブ)をフォアグラウンドで再開します。
fg 1 ジョブ番号1のジョブをフォアグラウンドで再開します。

bgコマンド

# bg
# bg [ジョブ番号]
コマンド例 説明
bg カレントジョブ(最後に停止したジョブ)をバックグラウンドで再開します。
bg 1 ジョブ番号1のジョブをバックグラウンドで再開します。

Ping-t

jobs

fg

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?