Every running program is a process with an ID — and three commands cover almost everything you need to know about it.
What a process is #
The moment you run python app.py, Linux creates a process for it and hands it a unique number — the PID (Process ID). That number is how you’ll refer to it for everything that follows: checking on it, or killing it.
psWhat is running?
↓
topWhat is happening right now?
↓
killStop a process.
ps aux # snapshot of every process, for every user
top # live, continuously updating view
kill 1234 # ask a process to stop, gracefully
kill -9 1234 # force it — SIGKILL, no cleanup allowed
Prefer
kill PID over kill -9 PID whenever you can. The plain version gives the application a chance to shut down cleanly; -9 yanks the plug.Foreground vs background #
A command you run normally occupies your terminal — that’s a foreground process. Add & and it runs in the background, freeing your terminal up immediately:
sleep 100 &
# [1] 1234 → job number 1, PID 1234
Ctrl + Z # suspend the foreground job
bg # send it to the background
fg # bring it back to the foreground