ps (Process Status)
# List processes running in terminal emulators, can be in another terminal window, even if it's another emulator (e.g., iterm2 + alacritty)
ps
# Display information about other users' processes, including those without controlling terminals.
ps -e
# Columns
ps -f # uid (UID), pid (PID), parent pid (PPID), recent CPU usage (C), process start time (STIME), controlling tty (TTY), elapsed CPU usage (TIME), associated command (CMD)
ps -l # uid (UID), pid (PID), parent pid (PPID), flags (F), cpu (CPU), pri (PRI), nice (NI), vsz (SZ), rss (RSS), wchan (WCHAN), state (S), paddr (ADDR), controlling tty (TTY), elapsed CPU usage (TIME), associated command (CMD)
ps -o pid,ppid,%mem,%cpu,user,command # comm for sort command
# user
ps --user hv
ps -u hv # macos
# sort (linux only)
ps --sort=%mem
ps --sort=%cpu
ps --sort=-%cpu # descent order
ps --sort=ppid,-%cpu # two columns
# Combined
ps -eo pid,ppid,%mem,%cpu,user,command
ps
always show the ps command itself in the list. Because when the processes are listed ps is currently running