List all running processes
ps aux
Find process by name
ps aux | grep nginx
Or use pgrep:
pgrep -a nginx
Kill process by PID
kill 1234
Force kill process
kill -9 1234
Kill all processes by name
pkill nginx
Interactive process viewer
top
Press q to quit, k to kill a process, M to sort by memory.
Better alternative: htop
htop
Check CPU and memory usage
top -bn1 | head -20
List processes using a specific port
lsof -i :8080
Background a running process
Ctrl+Z to suspend, then:
bg
Bring background process to foreground
fg
Run command in background
nohup ./long_script.sh &