← Linux & the Command Line tutorial
Processes
ps aux lists every running process. top
shows a live, auto-refreshing view of what's using CPU and memory right
now.
Example: finding and stopping a specific process
$ ps aux | grep python
$ kill 4821
The grep filters ps's full output down to
just lines mentioning "python" — piping is covered properly in the next
lesson, but this is one of its most common real uses: a command produces
too much output, and a second command narrows it down to what you
actually care about. Once you've found the right process id (PID) —
4821 here — kill stops it. Add -9
(kill -9 4821) to force-kill a process that isn't responding
to the normal, more polite request to stop.
$ ps aux | grep python
$ kill 4821
The grep filters ps's output down to lines mentioning "python", e.g. showing PID 4821 — which the kill command then stops.