San Diego State University logo

*Technical Briefs*
ROHAN help Files

----------------------------------------------------------------------

background/foreground

Running a command in the background is useful when you know that the command will take a long time to run, or if (as in the case of running Graphically Oriented programs such as Netscape on an X Terminal) you want to be able to keep control of the command line and run more than one program at a time. For example, at the ROHAN prompt type:

rohan%  make  programname  &

make will run in the background and compile the program for you, but you still have control of the command line and can run other programs simultaneously.

When a command is started in the background using the & metacharacter, the shell displays a line with the job number in brackets and a list of associated process numbers. To see the current list of commands that you are running, at the ROHAN prompt type:

rohan%  jobs

This will list all the jobs you currently have running.

To bring a job to the foreground, so that you can manipulate it in some way, at the ROHAN prompt type:

rohan%  fg  jobnumber

jobnumber refers to the number in brackets next to each job in the list.

If only one job is currently running, typing fg by itself will bring that job into the foreground. If more than one job is running, typing fg by itself will bring the last job that was placed in the background to the foreground.

----------------------------------------------------------------------


BACK ROHAN Help Index | Academic Computing Handouts, Manuals, and Help Files

This page last modified: December 11, 2002
Send comments/suggestions about this web page to webmaster@rohan.sdsu.edu

SDSU Faculty and Students may send questions about software on ROHAN or ROHAN UNIX problems to problems@rohan.sdsu.edu