Skip to content
Linux

Process Management

List, signal, and monitor running processes.

By EZ4Code Team
processkillsignal

Code

# List processes
ps aux | grep nginx
ps -ef --forest               # tree view
pgrep -fl nginx

# Top and htop for live monitoring
top -o %CPU
htop

# Send signals
kill 1234                      # SIGTERM
kill -9 1234                   # SIGKILL (force)
pkill -f "node server.js"
killall nginx

# Background and foreground
long-task &
jobs
fg %1
bg %2
nohup ./server > server.log 2>&1 &

# Nice and renice for priority
nice -n 10 ./batch-job
renice -n -5 -p 1234

Explanation

ps lists snapshots of processes, while top and htop show live CPU and memory usage. kill sends signals to a PID, with SIGTERM (15) for graceful shutdown and SIGKILL (9) as a last resort. nohup detaches a process from the controlling terminal so it survives logout, and nice adjusts CPU scheduling priority.

More Linux Snippets