Manipulating Jobs

   

Korn Shell: Unix and Linux Programming Manual, Third Edition, The
By Anatole Olczak

Table of Contents
Chapter 5.  Job Control


Jobs running in the foreground are suspended by typing Ctl-z (Control-z). So instead of waiting for the long-running split command to complete, it is interrupted using Ctl-z:

 $ split ?000 hugefile  Ctl-z  [3] + Stoppedsplit ?000 hugefile  $ 

Stopped and backgrounded jobs are brought back into the foreground with the fg command. If no argument is given, the current (most recently stopped or backgrounded) job is used. The stopped split job is brought back into the foreground with fg:

 $ fg  split ?000 hugefile 

Stopped jobs are put into the background with the bg command. If no argument is given, the most recently stopped job is used. In the next example, we want to put the split job back in the background. It is currently running in the foreground, so it must first be suspended with Ctl-z again:

 $ fg  split ?000 hugefile  Ctl-z 

Now, it can be put into the background using bg:

 $ bg  [3]   split ?000 hugefile & 

The split job is brought into the foreground with fg, and we are back to where we started. This time we use the job number as the argument to fg:

 $ fg %3  split ?000 hugefile 

       
    Top
     



    Korn Shell. Unix and Linux Programming Manual, Third Edition
    Korn Shell. Unix and Linux Programming Manual, Third Edition
    ISBN: N/A
    EAN: N/A
    Year: 2000
    Pages: 177

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net