ps
List processes
What it does
ps aux lists every process on the system: the user, the PID (process ID), CPU and memory use, the start time and the command. The letters go without a dash: an old BSD style of flags.
The list is long, so you filter it: ps aux | grep nginx. The grep itself shows up in the result, and that is normal. pgrep -a nginx does the same more briefly, printing just the PID and the command.
Syntax
ps aux
ps aux | grep <name>
pgrep -a <name>Examples
List every process on the system
ps auxps— list processesaux— of all users, with owners, background ones included
Find the nginx processes and their PIDs
ps aux | grep nginxps aux— every process| grep nginx— keep the lines with nginx