How do I execute a command in the background

Using the "&" at the end of the command. For example, this will start licq (an icq client) in the x-terminal in the background, so that after issuing the command, my x-terminal is not blocked:

licq &

The process identification number, job_number, is printed on the screen, so you can use it with related commands. The related commands are fg job_number (="foreground", bring the background process back to my immediate view/control, restart it if it was stopped), bg job_number (="background", send the process to the background, restart if it was stopped, exactly as if it was started using &), <Ctrl>z (send the current foreground process to the background and stop it), jobs (list the active jobs), kill process_ID (terminate the process, use the conmmand ps to find the process_IDof the process to kill).

To make a background process keep running after you disconnect, you may use the nohup (="no hungup"), for example:

nohup make &

that maybe compiling a large program.

0 0

Post a comment