Linux Processes and Jobs: A Beginner Guide
Before you begin
- Applies to:Linux with interactive Bash and the procps versions of ps and top.
- Where to start:Open one Bash terminal and keep it open throughout. Job numbers are local to that shell.
- What you need:Use a regular account. The exercise starts a harmless process and does not require sudo.
Guide tools
A process is a running program. Each process has a PID, a number Linux uses to identify it. Your terminal shell is a process, and so is each command it starts.
A job is a command that your shell is tracking. You will start one harmless waiting command, pause it, resume it, and stop it. This gives you a safe way to learn process control before working with real applications.
Read ps and top β Your own shell job β Use its job number β Confirm it is gone.
See a Simple Process List
Start Hereps shows a snapshot of processes associated with your terminal. PID is the process ID, TTY is the terminal, TIME is accumulated CPU time, and CMD is the program name. A sleeping process can exist for minutes while using almost no CPU time.
psβ― What to expect
Example only; your IDs differ: PID TTY TIME CMD 4200 pts/0 00:00:00 bash 4210 pts/0 00:00:00 psOpen a Live Process View
Practicetop refreshes the display while it runs. Look at PID, COMMAND, %CPU and %MEM. CPU measures processor activity; memory measures RAM use. Press the letter q to exit top and return to your prompt.
topβ― What to expect
A refreshing screen of processes.Press q when you have finished looking.Start Your Own Harmless Background Job
Practicesleep 600 waits for ten minutes and then exits. Adding & starts it in the background, so you can keep typing. Bash prints a job number in brackets and the operating-system PID. jobs -l lists this shellβs jobs, including PIDs.
sleep 600 &jobs -lβ― What to expect
Example when this is the first job:[1] 4250[1]+ 4250 Running sleep 600 &Pause the Practice Job
Practicekill sends a signal: a message asking a process to do something. -STOP pauses it. The name kill is historical; this signal does not terminate the process. The status should change to Stopped.
kill -STOP %1jobs -lβ― What to expect
[1]+ 4250 Stopped (signal) sleep 600The notification wording and PID can differ.Resume the Same Job
Practicebg resumes a stopped job in the background. Check that it returns to Running. It continues waiting until its original time expires or you stop it.
bg %1jobs -lβ― What to expect
[1]+ sleep 600 &[1]+ 4250 Running sleep 600 &Ask the Practice Job to Exit
PracticeRecheck the job immediately before sending a signal. -TERM requests termination and lets applications handle shutdown. The sleep program exits. A successful kill command normally prints nothing; Bash may show a termination notification just before your next prompt.
jobs -lkill -TERM %1β― What to expect
Bash may print a Terminated notification.The kill command itself normally has no output.Confirm That Your Practice Job Is Gone
VerifyThe sleep job should no longer appear. Other jobs you already had can still be listed; leave them alone. No files or settings were created by this exercise.
jobs -lβ― What to expect
No output if you had no other jobs.The practice sleep 600 should not be Running or Stopped.References and next steps
Your feedback keeps these production procedures accurate and battle-tested.