Bash job control lets you pause a running command, continue it in the background or foreground, inspect its state, wait for completion, and decide what happens when the shell exits. Add & to launch a batch-like command asynchronously, press Ctrl-Z to suspend a foreground command, then use bg or fg with the job number shown by jobs. For work that must survive logout, redirect its input and output and use disown (or a service/session manager when appropriate).
Need a server to try this on? Antihost offers Linux VPS plans with NVMe storage, full root access and a 14-day free trial.
What Bash job control does
The GNU Bash Reference Manual defines job control as the ability to selectively stop (suspend) processes and continue (resume) them later. Bash treats each pipeline as one job and keeps an entry for it in a per-shell job table. A job may contain several processes, but Bash gives the pipeline one job number so you can manage it as a unit.
As an Amazon Associate I earn from qualifying purchases.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Job control is different from merely starting a process with a shell command. It connects shell bookkeeping with the terminal’s foreground process group. The foreground group can receive keyboard-generated signals such as SIGINT from Ctrl-C and the suspend signal generated by Ctrl-Z. Background groups do not receive those keyboard signals and normally cannot read from the controlling terminal.
Interactive job control is normally enabled in an interactive Bash session. A non-interactive shell, such as one running a script, generally does not provide the same interactive job-management behavior unless it is explicitly configured and attached to a suitable terminal.
#1 Best Overall
- [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
- [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
- [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
- [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
- [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.
Foreground and background execution compared
| Aspect | Foreground job | Background job |
|---|---|---|
| Shell prompt | Bash waits for the command and does not give you the prompt until it exits or is stopped. | Bash returns the prompt immediately after starting the asynchronous job. |
| Terminal input | Can normally read from the controlling terminal. | Cannot normally read from the controlling terminal; a read usually causes SIGTTIN and stops the process. |
| Keyboard signals | The terminal sends signals such as SIGINT and SIGTSTP to the foreground process group. |
It is in another process group and is immune to those keyboard-generated signals. |
| Job table | Tracked by Bash while it runs and after it stops, subject to normal job-table cleanup. | Tracked by Bash until it finishes, is removed, or is disowned. |
| Shell exit | A running or stopped job can cause an exit warning; shell hangup behavior depends on job state and disown settings. | A job still associated with Bash can receive SIGHUP when the shell exits; disown -h prevents Bash from sending that hangup. |
| Typical use | Interactive programs, commands needing terminal input, and tasks whose output you want to watch directly. | Long, batch-like commands such as builds, downloads, conversions, and log processing. |
Putting a command in the background does not automatically detach it from the terminal. Its standard input, standard output, and standard error still point wherever the command inherited them unless you redirect them explicitly.
Start a command in the background with &
Append an ampersand to the command or pipeline:
long_command >output.log 2>&1 &
The redirections send normal output and error output to output.log, while & asks Bash to run the command asynchronously. Because the command is no longer occupying the foreground, Bash prints a job number and a process ID, for example:
[1] 25647
The number and PID are examples; your session assigns different values. The bracketed value is the Bash job number, while the second value is a process ID. A pipeline such as producer | consumer is one Bash job even though it contains multiple processes.
Choose redirections for the kind of job
- For a command that only produces output, redirect at least standard output if terminal messages would interfere with your interactive work.
- Redirect standard error separately when you need to distinguish diagnostics, for example
command >out.log 2>error.log &. - Redirect both streams to one file with
>out.log 2>&1, as in the example above. - If the program might read input, provide an input file such as
<input.txt. Otherwise a background read from the terminal can stop it withSIGTTIN.
Use an explicit command such as long_command <input.txt >output.log 2>&1 & when you want a genuinely batch-like background task.
List jobs and understand the job numbers
Run jobs to display active jobs known to the current Bash process:
jobs
For process IDs and more detail, use:
jobs -l
A typical listing might show a running, stopped, or completed state. The exact text varies with the command and Bash version, but the leading number is the jobspec you use with other job-control builtins.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallJobspec forms
%1selects job 1.%%and%+select the current job, normally the one Bash considers most recently active.%-selects the previous job.- A unique command-name prefix can identify a job, such as
%longfor a job whose command begins withlong. - A unique substring can also identify a job with
%?text, wheretextoccurs in the command line.
If a prefix or substring matches more than one job, Bash reports an ambiguous jobspec. Run jobs and use the numeric form to remove uncertainty.
Jobs are local to a shell
The job table belongs to the Bash session that started the command. Opening another terminal, connecting through a second SSH session, or running a command under a different shell gives you a different job table. A PID visible through a system process tool is not automatically a jobspec in your current shell.
Rank #2
- 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
- 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
- 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
- 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
- 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.
Suspend a foreground command with Ctrl-Z
While a foreground process is running, press the terminal’s suspend character, typically Ctrl-Z. Bash stops the foreground job and returns the prompt. The manual describes this as typing the suspend character to stop the process and return control to Bash.
At that point the job is stopped, not completed. It remains in the job table and can be resumed without restarting it. Bash normally prints a message identifying the stopped job, such as [1]+ Stopped.
Continue the stopped job in the background
- Press
Ctrl-Zwhile the command is in the foreground. - Check the assigned number with
jobsif necessary. - Resume it asynchronously with
bg %1, replacing%1with the actual jobspec.
bg %1
bg resumes each specified stopped job in the background. With no jobspec, bg uses the current job:
bg
A resumed background job can continue writing to the terminal unless its output is redirected. Resuming it in the background does not change its inherited file descriptors.
Bring a job back to the foreground
Use fg with the job number:
fg %1
fg resumes a stopped job if necessary, makes its process group the terminal’s foreground group, and waits for it as the foreground command. With no jobspec, it selects the current job. The return status of fg is the status of the foreground command, so you can inspect it with echo $? immediately afterward.
A concise handoff is therefore:
# foreground command is running
# press Ctrl-Z
bg %1 # continue without occupying the prompt
fg %1 # take it back over the terminal later
Wait for a background job and collect its status
Use wait when a script or interactive session must pause until a job finishes:
wait %1
wait accepts jobspecs or process IDs. With several identifiers, it waits for them and returns the status of the last identifier it processes. To wait for a process to terminate rather than merely undergo a status change, Bash provides wait -f when job control is enabled:
wait -f %1
After waiting, inspect the exit status immediately:
Rank #3
- [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
- [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
- [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
- [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
- [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by
wait %1
status=$?
printf 'job exit status: %sn' "$status"
Waiting is different from bringing a job forward. wait does not attach the terminal to the job and does not make an interactive program usable; it only waits for the requested status condition.
Stop or signal a job with kill
When job control is active, Bash’s kill builtin can address a jobspec:
Recommended Free Tools
kill %1
That sends the default termination signal. Specify another signal when appropriate:
kill -STOP %1
kill -CONT %1
kill -TERM %1
SIGSTOP unconditionally stops a process and cannot be caught or ignored; SIGCONT continues a stopped process. A normal termination request uses SIGTERM, giving the program an opportunity to clean up. Use a PID instead when you are outside the shell’s jobs table or when a specific process in a larger job must be addressed.
To force a background process to stop because it is misbehaving or consuming resources, send SIGSTOP with the Bash builtin or an external signal tool as appropriate. Keyboard-generated signals from your terminal will not reach a background process group.
Keep work from being tied to a shell with disown
disown changes Bash’s bookkeeping; it does not create a daemon and does not redirect input or output. First start the command with suitable redirections, then disown it if you do not want this shell to manage it:
long_command </dev/null >output.log 2>&1 &
disown %1
After disown %1, Bash removes the job from its active table. jobs will no longer list it, and you cannot use that shell’s jobspec to run fg, bg, or wait for it.
Protect a job from Bash’s hangup signal while keeping it listed
Use the -h option to mark a job so Bash does not send it SIGHUP when the shell exits, while leaving the job in the table:
Rank #4
- Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
- Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
- All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
- Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
- Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.
disown -h %1
The form disown -h is useful when you still want to inspect or manage the job during the current session. It does not alter the program’s standard input, output, or error streams. A program that later tries to read the terminal can still be stopped, and output can still appear in the terminal unless redirected.
Control the scope of disown
In Bash’s syntax, disown [-ar] [-h] [id ...] accepts options and job identifiers. With no identifier, it acts on the current job. The -a option applies to all jobs; -r limits the operation to running jobs. Use these broader forms deliberately because they can affect more jobs than the one you intended.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsFor an interactive session that must survive a logout reliably, a terminal multiplexer or a service manager is usually more appropriate than treating disown as a full process supervisor. Job control only changes Bash’s relationship with the process; it does not provide restart policies, logging rotation, dependency ordering, or monitoring.
How the terminal and process groups explain job-control behavior
The terminal maintains one foreground process group. When a foreground pipeline runs, the processes in that group receive keyboard-generated signals. Bash temporarily manages the terminal for the job and waits for the foreground command; Bash itself is not in that same terminal process group while it is waiting, so it does not receive those keyboard-generated signals intended for the command.
Background processes belong to a different process group. A background process that attempts to read from the controlling terminal normally receives SIGTTIN, which stops it. This is why an interactive program that needs input should generally remain in the foreground or receive input from a redirected file.
Writes are normally allowed, so a background job may print over your prompt. If the terminal’s tostop setting is enabled, however, a background write can cause SIGTTOU and stop the writer. Redirecting output avoids both confusing terminal interleaving and many write-related surprises.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →The shell’s signal handling explains another common misconception: pressing Ctrl-C while a background job is running at your prompt does not normally interrupt that job, because the job is not in the terminal’s foreground process group. Use kill with the job’s jobspec or PID when you need to signal it.
Commands and options at a glance
| Command | Purpose | Important behavior |
|---|---|---|
jobs [-lnprs] |
List active jobs. | -l includes process IDs; other flags select listing formats and states. |
jobs -x command [arguments] |
Run a command after substituting process-group IDs for jobspecs in its arguments. | Useful when a command expects numeric process-group IDs rather than Bash’s % notation. |
bg [jobspec ...] |
Continue stopped jobs in the background. | No jobspec means the current job. |
fg [jobspec] |
Continue a job in the foreground. | No jobspec means the current job; its status is the foreground command’s status. |
wait [jobspec|pid ...] |
Wait for jobs or processes. | Returns the status of the last identifier; -f waits for termination rather than a status change when job control is enabled. |
kill [options] jobspec|pid |
Send a signal. | Jobspec use requires an active Bash job table; signal names such as -STOP, -CONT, and -TERM select the action. |
disown [-ar] [-h] [id ...] |
Remove jobs from Bash or prevent a hangup signal. | -h keeps the job listed but suppresses Bash’s SIGHUP; without -h, the job is removed. |
suspend |
Pause the shell itself until SIGCONT. |
A login shell or shell without job control cannot normally be suspended; suspend -f forces it. |
Reliable workflows for common tasks
Run a long batch command and return to the prompt
- Decide where standard input, output, and error should go.
- Launch the command asynchronously:
long_command </dev/null >output.log 2>&1 &. - Record the job number and PID printed by Bash.
- Use
jobs -lto inspect its state later. - Run
wait %1when you need the completion status.
Pause an interactive command, do something else, then resume it
- Press
Ctrl-Zto stop the foreground command. - Run a short command or inspect the job with
jobs. - Use
bg %1to let the stopped command continue without the terminal. - Use
fg %1when you need to interact with it again.
Cancel a background job
- Run
jobs -land identify the correct jobspec. - Send a graceful termination request with
kill %1orkill -TERM %1. - Check the result with
jobs. - If the process remains and you have confirmed it is safe to force it, use a stronger signal such as
kill -KILL %1; this gives the program no opportunity to clean up.
Troubleshooting job-control errors
“fg: no such job” or “bg: %1: no such job”
The jobspec may belong to another shell, the job may already have exited, or the number may be wrong. Run jobs in the same shell that started the command. Use the displayed number, %+, or %- rather than guessing.
Best Value
The background command stopped unexpectedly
Check jobs for a stopped status. The most common cause is a read from the controlling terminal, which triggers SIGTTIN. Restart or resume the command with input redirected from a file or another intended source. If tostop is enabled, a background write may instead have triggered SIGTTOU; redirect output to a file or pipe.
Output is mixed into the prompt
Background status does not silence a program. Redirect standard output and standard error when launching it, or send them through a logging pipeline. Redirecting after the command has started generally requires restarting it with the desired file descriptors.
Free tools Windows power users keep installed
One-click scans. No signup required.
The job disappeared after the shell closed
If you used disown without -h, Bash removed the job from its table, but that alone does not guarantee survival. If the shell exits while it still owns a job, Bash may send SIGHUP. Use explicit input and output redirections and disown -h when you need to prevent Bash’s hangup signal. For durable services, use a supervisor designed for that purpose.
Bash warns about jobs when exiting
Bash can warn about stopped jobs on shell exit. With the checkjobs option enabled, it can also warn about running jobs and list their statuses. Treat the warning as a prompt to inspect jobs, then bring a job forward, terminate it, or disown it intentionally rather than closing the terminal blindly.
Ctrl-C does not stop the background process
That behavior is expected: keyboard-generated signals go to the terminal’s foreground process group, not to a background group. Use kill %jobspec or a PID to signal the background process.
Limits of job control
Job control is a shell-and-terminal feature, not a replacement for process supervision. It is ideal for deciding whether an interactive command currently owns your terminal and for moving work between stopped, foreground, and background states. It does not restart failed programs, preserve a process across every kind of session termination, provide service dependencies, or guarantee that a program designed for terminal interaction will work unattended.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
For a command that simply needs time to finish, launch it with complete redirections, inspect it with jobs -l, and use wait when its result matters. For an interactive command, keep it in the foreground whenever it needs keyboard input, and use Ctrl-Z, bg, and fg as temporary state changes rather than as a substitute for configuring the program’s input and output.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




