fg

Official Description

Runs jobs in the foreground.

Syntax

fg [job_id...]

Options

None

Oddities

The C shell has its own version of fg.

It's useful for jobs that are in the background and need to be brought to the foreground for input processing.

Example

 $ cd /tmp $ $ /bin/rm -i *& # Do a rm –I command in the background [1] 4272 $ in/rm: remove 'buzz4'? $ [1] + Stopped (SIGTTIN) /bin/rm -i *& $ $ jobs # Command is stopped and in the background [1] + Stopped (SIGTTIN) /bin/rm -i *& $ $ fg %1 # Bring command to the foreground /bin/rm -i * n /bin/rm: remove 'dentest1'? n # Respond to its needs /bin/rm: diffs: is a directory /bin/rm: remove write-protected file 'difftemp2'? n /bin/rm: remove 'junk'? n (CTRL+C) # Stopped the rm command with a Ctrl+C ...

Get Korn Shell Programming by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.