IntermediateLesson 5 of 5 · 1 min read
Processes and the System
ps, top, kill, and how to find what is running.
A process is a running program. Linux gives every process a numeric ID called a PID.
Inspecting processes
ps aux # snapshot of all processes
top # live, updating view (q to quit)
pgrep -a node # find processes by name
Killing processes
kill 1234 # polite shutdown (SIGTERM)
kill -9 1234 # force kill (SIGKILL) - last resort
pkill -f "python app" # kill by pattern
System info
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.
Your notes
Notes are kept on this browser only.
Challenge
Show the top of the `ps aux` output filtered to lines containing the word `root`.
Need a nudge?
Tip: type the command in the sandbox on the right, or paste the solution here. The sandbox runs in real time.
Quiz
Answer these to lock in the concepts. Score at least 80% to mark the lesson complete.
Mark as complete
Skipped the challenge? You can mark this lesson done by hand.