リナックス linux 入門 初心者 コマンド

リナックス  linux  コマンド の情報満載です。 探しているlinux リナックス  コマンド はこちらです。


bg  ジョブ バックグラウンド 実行 切り替え

 構文  
bg [%jobsid]  

 オプション  
%jobsid

バックグラウンドで実行するコマンドの
 ジョブ番号を指定する

ジョブ番号はjobsコマンドにて確認できる。

[takuan@localhost ~]$ jobs
[1]-  Stopped                 vim tmp.txt
[2]+  Stopped                 find / -name *.txt
 

 説明  
ジョブをバックグラウンドで実行するコマンドです。
パラメータを省略した場合は
カレントジョブ(+のついたジョブ)を実行します。


[takuan@localhost ~]$ find / -name *.txt
find: /var/cache/mod_proxy: 許可がありません
省略・・・

^Z
[1]+  Stopped                 find / -name *.txt
[takuan@localhost ~]$ jobs
[1]+  Stopped                 find / -name *.txt
[takuan@localhost ~]$ bg
[1]+ find / -name *.txt &



find: /etc/lvm/archive: 許可がありません
find: /etc/cups/ssl: 許可がありません

[1]+  Exit 1                  find / -name *.txt
[takuan@localhost ~]$

       bg [jobspec ...]
              Resume each suspended job jobspec in the background, as if  it  had
              been started with &.  If jobspec is not present, the shell's notion
              of the current job is used.  bg jobspec returns 0 unless  run  when
              job  control is disabled or, when run with job control enabled, any
              specified jobspec was not found or was started without job control.

 使用例  



[takuan@localhost ~]$ touch tmp.txt

→tmp.txtの作成


[takuan@localhost ~]$ vi tmp.txt
省略
~
~
"tmp.txt" 0L, 0C                                                        0,0-1        全て

[1]+  Stopped                 vim tmp.txt

→viでtmp.txtを開き、ctr+z で中断


[takuan@localhost ~]$ find / -name *.txt
find: /var/cache/mod_proxy: 許可がありません
省略

^Z
[2]+  Stopped                 find / -name *.txt

→findコマンドで検索中にctr+zで中断


[takuan@localhost ~]$ jobs
[1]-  Stopped                 vim tmp.txt
[2]+  Stopped                 find / -name *.txt


→現在のジョブの表示



[takuan@localhost ~]$ bg %2
[2]+ find / -name *.txt &

→bgコマンドにてバックグランドでfindコマンドを実行

[takuan@localhost ~]$ jobs
[1]+  Stopped                 vim tmp.txt
[2]-  Running                 find / -name *.txt &


jobsコマンドにて確認すると[2]のfindコマンドがRunningとなっている。




省略・・・
find: /etc/cups/ssl: 許可がありません

[2]-  Exit 1                  find / -name *.txt


→[2]がバックグランドで実行が終わる。


[takuan@localhost ~]$ jobs
[1]+  Stopped                 vim tmp.txt





  「この記事は役に立ちました。」という場合には
ブログランキングボタンをクリックしていただけると大変、助かります。

ブログランキング

blogram投票ボタン


トラックバック(0)

このブログ記事を参照しているブログ一覧: bg  ジョブ バックグラウンド 実行 切り替え

このブログ記事に対するトラックバックURL: http://websky21.com/MT/mt-tb.cgi/827

Linuxコマンド一覧

ブックマークに追加

RSSフィード登録

ボタン をクリックするだけで RSSフィードを登録できます。 非常に便利で簡単に登録できてオススメです!

ATOM RSS

Bloglinesで閲読登録

ADD TO Hatena::RSS

Subscribe with livedoor Reader

Add to Google

goo RSSリーダーに追加

My Yahoo!に追加

フィードメーター - リナックス linux 入門   初心者 コマンド

リナックス 掲示板


2010年10月

          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31            
  RANKING⇒ banner_14.gif

RANKING⇒
RANKING⇒ blogram投票ボタン