ps
what is runningps prints a snapshot of the process table. ps aux is the form to remember: every process, from every user, with its owner and resource use. The number in the PID column is the handle every other management command needs.
Everything running on the machine is a process with a number and an owner — and ps is the list.
At the terminal
Read the session first, then the notes: each numbered line in the output is answered by the note with the same number.
What the numbered lines are telling you
RSS is the physical memory in use, in kibibytes. VSZ is everything the process has reserved, most of which it may never touch.
mysqld is a daemon: nobody typed it into a shell. In STAT, S is sleeping, s a session leader and l multi-threaded.
This one was started by hand in a shell. The + in STAT says it is in the foreground of that terminal.
init — systemd on most systems — is started by the kernel and is the ancestor of everything else.
Switches
A switch changes how the command behaves. These are the ones used day to day; man ps lists the rest. Single-letter switches can usually be joined, so -l -a may be written -la.
aux- BSD style, no dash: every process, with its owner, CPU and memory use.
-e- Every process on the system. -A is the same.
-f- Full format: adds the parent process id and the full command line.
-u USER- Only the processes belonging to this user.
-p PID- Only the process with this id.
--forest- Draw parent and child processes as a tree.
-o FIELDS- Choose the columns yourself, for example -o pid,user,%cpu,cmd.
Variations worth knowing
The same tool, pointed at a narrower question. These four cover most of what it is reached for day to day.
ps -ef --forestDraws the parent-child tree, so you can see which process started which.
ps -u www-dataOnly the processes owned by one user.
pgrep -a nginxFinds processes by name and prints their PIDs — tidier than piping ps into grep.
topThe same table, refreshed live and sorted by CPU. Press q to leave.
In cybersecurity
The process list is the inventory of what the machine is actually doing, and it is visible to every local user by default.
Arguments appear in the COMMAND column for everyone to read. A password passed as a flag is a password published.
An unfamiliar name, a binary running from /tmp, or a web-server user running a shell are all classic signs of a compromise.
The USER column is the blast radius. A service that does not need root should not appear here as root.