Previous | Table of Contents | Next |
DESCRIPTION
The internal fg command resumes stopped or suspended jobs by placing them in the foreground. The fg command is part of the job control feature of the C shell and the Korn shell. If a job is in a suspended state you can no longer interface with it. When a job is brought back into the foreground it becomes interactive again.
COMMAND FORMAT
Following is the general format of the fg command.
fg [ %job ... ]
Arguments
The following arguments may be passed to the fg command.
%job | A job number associated with a process. If the interactive option is turned on, job may be one of the following: |
% num | A job number associated with a process | |
% string | The job whose name begins with string | |
%? string | The job whose name contains string | |
%+ %% | Current process, the last process you stopped or suspended | |
%- | Previous process, the job before the current job |
RELATED COMMANDS
Refer to the bg , jobs , and kill commands described in modules 9, 68, and 70.
APPLICATIONS
The fg command is used to force suspended or stopped jobs into the foreground. This brings the job back into interactive mode, allowing you to interface with it from your keyboard. For instance, if you are in vi and decide to suspend the editor, you type Ctrl-Z. Now vi is suspended in background. You can use the jobs command to display all background and suspended jobs. After you perform various other commands you can return to your suspended vi session by typing fg %1 and pressing Return . Since this is the current job you could just type fg .
TYPICAL OPERATION
In this activity you use the fg command to restart a process you have suspended. Begin at the shell prompt.
cj> vi x
^Z ~ . . ~ "x" [New file] [1] + Stopped vi x cj>
Previous | Table of Contents | Next |