Intermediate LinuxLesson 10 of 27 1 min read
Processes and the System
ps, top, kill, and how to find what is running.
On this page4 sections
A process is a running program. Linux gives every process a numeric ID called a PID.
Inspecting processes
bash
ps aux # snapshot of all processes
top # live, updating view (q to quit)
pgrep -a node # find processes by name
Killing processes
bash
kill 1234 # polite shutdown (SIGTERM)
kill -9 1234 # force kill (SIGKILL) - last resort
pkill -f "python app" # kill by pattern
System info
bash
uname -a # kernel info
uptime # how long the system has been up
free -h # memory usage
df -h # disk space
Foreground vs background
- Run normally:
python app.py(foreground) - Run in background:
python app.py & - Bring back to foreground:
fg
These tools are your first stop when something is wrong on a server.
Challenge
Show the top of the ps aux output filtered to lines containing the word root.
Want to experiment first? Try things in the practice terminal (opens in a new tab), then enter the command that solves the task here.
Quiz
Lock in the concepts. Score at least 80% to mark the lesson complete.
Done with this one?
Skipped the challenge? You can mark the lesson complete by hand.
Your notes
Kept on this browser only.