Start a long-running job in the background, inspect it with
jobs, bring it to the foreground, suspend it, then
resume it in the background. Terminate the job cleanly using
kill by PID once you confirm the correct target.
You are multitasking in a terminal while running a long command in the background. You need to list active jobs, move the job into the foreground when you need focus, suspend it, resume it in the background, then terminate it once the work is no longer needed.
Job control is how you stay productive in a shell. It helps you manage long-running tasks without opening extra terminals or losing control of what is running where.
kill.&.
jobs.
fg
and Ctrl+Z.
bg.
kill.
sleep 1000 &
Appending & runs the command as a background
job and immediately returns control to your prompt.
[1] 1843
jobs
jobs shows active jobs for the current shell.
Note the job number (%1) and the state
(Running or Stopped).
[1]+ Running sleep 1000 &
fg %1
# OR (only job)
fg
Foregrounding the job attaches it to your terminal. In this lab flow, you then suspend it with Ctrl+Z, which stops the job but keeps it tracked by the shell.
sleep 1000
^Z
[1]+ Stopped sleep 1000
bg %1
# OR (only job)
bg
bg continues a stopped job in the background.
Use jobs again if you want to confirm state.
[1]+ sleep 1000 &
kill 1843
# OR
kill -15 1843
kill sends a signal to the PID. With no signal
specified, it sends SIGTERM (15) by default,
which is the standard "request to exit" behavior.
[1]+ Terminated sleep 1000
sleep 1000 &
: Starts a long-running command in the background.
jobs
: Lists jobs managed by the current shell session.
fg %<job>
: Brings a job into the foreground (attaches it to the TTY).
SIGTSTP), leaving
it in a stopped state.
bg %<job>
: Resumes a stopped job in the background.
kill <pid>
: Sends SIGTERM by default to request clean
termination.
kill -15 <pid>
: Explicitly sends SIGTERM.