Bash & Linux·Bash from first command to automation

Processes

Inspect running work, stop it safely and understand foreground versus background.

Beginner 12 min read Lesson 6 of 300 Challenge included
What you will be able to do
  • Use ps aux or top to inspect processes.
  • Use Ctrl+C for SIGINT and Ctrl+Z to suspend.
  • Use kill -TERM before kill -9.
  • Use jobs and fg/bg for shell jobs.

In plain English

Every running program is a process with a pid. Run long jobs in the background with &, keep them alive with nohup or a process manager, and stop them with kill using the right signal. SIGTERM asks politely; SIGKILL does not.

terminalTerminal
sleep 60 &
jobs
ps -p $! -o pid,cmd
kill -TERM $!
Your turn

Run in the background

Easy

Start sleep 30 in the background and print its pid.

BASH · starter
sleep 30
Check your understanding before moving on.
Knowledge checkQuestion 1

Which signal asks a process to shut down gracefully?

Select an answer to continue
Study tools

Make it yours.

Keep a private note for this lesson, then turn the key ideas into flashcards you can revisit.

Sign in to save notes and flashcards.Both are private to your account and stay with your progress.
Sign in
Finished reading?

Lock in what you just learned.

Mark this lesson complete to save your place and move one step closer to the certificate.

Next: Shell scripting
Lesson 6 of 300 · 0% of course