nohup fg bg jobs
Run a Unix process in the background
In Unix, a background process executes independently of the shell, leaving the terminal free for other work. To run a process in the background, include an &
(an ampersand) at the end of the command you use to run the job. Following are some examples:
- To run the
count
program, which will display the process identification number of the job, enter:count &
- To check the status of your job, enter:
jobs
- To bring a background process to the foreground, enter:
fg
- If you have more than one job suspended in the background, enter:
fg %#
Replace
#
with the job number, as shown in the first column of the output of thejobs
command. - You can kill a background process by entering:
kill PID
Replace
PID
with the process ID of the job. If that fails, enter the following:kill -KILL PID
- To determine a job's PID, enter:
jobs -l
- If you are using
sh
,ksh
,bash
, orzsh
, you may prevent background processes from sending error messages to the terminal. Redirect the output to/dev/null
using the following syntax:count 2> /dev/null &
At Indiana University, for personal or departmental Linux or Unix systems support, see Get help for Linux or Unix at IU.
The following wiki, pages and posts are tagged with
Title | Type | Excerpt |
---|---|---|
bash command line summary | post | Thu, Oct 21, 21, cmder bash commandline tools hotkeys and how to create sh file to automate actions |
cheatsheet and my customization | post | Fri, Oct 22, 21, cheatsheet for both tmux tmuxinator |
nohup and fg/bg jobs | post | Sat, Jan 22, 22, how to use nohup related bash commands |
sed-problem-solving.md | post | bash for windows and linux |
jekyll-playground | post | md/kramdown table, datatable 마크다운 테이블 스타일링 |