Linux Basics: Checking Running Processes
A process is a running instance of a program. Debian and Ubuntu provide ps for a snapshot of processes and top for a continuously updated view.
List your processes
ps -u "$(id -u)" -o pid,ppid,stat,commid -u prints your numeric user ID. The surrounding $(...) inserts that result into the command. Here, -u selects processes with your effective user ID.
-o chooses the columns: pid is the process ID, ppid is its parent’s ID, stat is its state, and comm is the command name. Common state letters include R for running or runnable and S for sleeping while waiting for something.
Inspect a practice process
Run these commands in the same Bash terminal:
sleep 60 &
practice_pid=$!
ps -p "$practice_pid" -o pid,etime,stat,commsleep waits for 60 seconds. The trailing & starts it in the background so you can keep typing. $! holds the ID of the most recently started background process; the assignment saves it for the next command.
-p selects that process, and etime shows how long it has existed. Run the inspection before the minute ends. Afterward, the process exits by itself and is no longer listed.
Watch activity
toptop refreshes CPU, memory, and process information. Press q to exit. Names and numbers vary with the programs running on your machine.
Start by observing which program a process belongs to. These examples do not stop applications or change system services.
Reference
Acknowledgements
This post was created with assistance from AI.
Linux Basics — lesson 17 of 25. Series index
Previous: Checking System Information · Next: Checking Services and Logs