Day 9 of 90 Days of DevOps: “Ctrl+C, Ctrl+Z & The Secret Life of Linux Processes”


Hey DevOps explorer!
Welcome to Day 9 of this wild DevOps journey. Today, we’re diving into the mysterious and often dramatic world of Linux Processes and Signals — where background jobs go rogue, and kill
isn’t always a bad thing.
What is a Process in Linux?
A process is basically a program in execution. Whenever you run a command, whether it’s ls
, vim
, or launching a full-blown server — boom, a process is born.
Each process gets a unique PID (Process ID). Think of it as a social security number for programs.
Foreground vs Background
Let’s clear up the basics:
Foreground Process: You run a command, and the shell waits for it to finish.
👉 Example:sleep 10
Background Process: You run a command and tell the shell, “Hey, carry on, I’ll check back later.”
👉 Example:sleep 100 &
Run jobs
to see your background tasks.
Use fg
to bring one back to the foreground, or bg
to send it back.
Signals: The Messages Processes Understand
Linux processes can receive signals – like messages saying:
SIGINT (2) – "Hey, stop that!" (Triggered by
Ctrl+C
)SIGTSTP (20) – "Pause a second!" (Triggered by
Ctrl+Z
)SIGKILL (9) – "Die. Now. No questions."
SIGTERM (15) – "Could you please exit nicely?"
Use kill -SIGNAL PID
to send a signal.
kill -9 1234 # Forcefully kills the process with PID 1234
kill -15 1234 # Politely asks it to terminate
Or be more elegant:
pkill -f process_name # Kill by name
Real-Life DevOps Use Cases
Got a stuck deployment? Use
ps aux | grep <name>
to find the culprit.Need to gracefully restart a service? Use
kill -HUP
to refresh configs.Accidentally launched a heavy script? Use
Ctrl+Z
, thenkill %1
.
Pro Tips
top
orhtop
→ Monitor all running processes.nice
&renice
→ Set priorities for processes (aka "don’t hog all the CPU").Always prefer
SIGTERM
beforeSIGKILL
. Give processes a chance to exit cleanly.
Summary
Understanding how Linux manages processes is like learning the control room of the operating system. You’ll be the one pulling the levers and sending signals like a DevOps wizard 🧙♀️.
What’s Next?
Tomorrow, we’ll level up into more powerful territory. But today, play around with:
sleep 100 &
jobs
fg
bg
kill %1
Explore. Break things. Kill things (only in the terminal, of course 😄).
See you on Day 10!
Let the signals guide you.
Subscribe to my newsletter
Read articles from ByteMotive directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
