nohup run a command immune to hangups, with output to a terminal
nohup preceeds the command to execute.
A command can be run asynchronously with the suffix
The interpreter then returns to the prompt and waits for a next command while the previous one still runs.
The command is said to be in the background.
To put the command back to the foreground, the command
fg must be used.
sleep 1 sleep 10 & ps fg
A running process (job) can be stopped with
Ctrl-Z (=type the
Control key then
Then the prompt is back and the job is in stopped state.
Two choices are possible:
run in the background using the
run in the foreground using the
The job can also be killed using the command:
If several jobs are stopped or are running in the background, they can be referred to by numbers:
kill %2 fg %3