Next / Previous / Contents / TCC Help System / NM Tech homepage

5. Controlling multiple processes

Normally, a command is executed in the foreground, which means it can read input from the keyboard and send messages to the screen.

If you have a process that does not need to read input from the keyboard, you can run it in the background, without tying up your window. To do this, end the command with an ampersand (“&”):

command&

The command will be assigned a job number that will be displayed in square brackets. You can use this job number to control the process.

Commands for process control:

control-Z

Suspend the current foreground job.

stop jobno

Suspend job jobno, but it can be resumed.

kill %jobno

Terminate jobno.

bg %jobno

Resume jobno in the background.

fg %jobno

Resume jobno in the foreground.

jobs

Show all the current background jobs.

ps -gx

Show all your processes on this machine by process ID number.

kill -9 pid

Kill a process using its process ID number.