Apps Artificial Intelligence CSS DevOps Go JavaScript Laravel Linux MongoDB MySQL PHP Python Rust Svelte Vue

View and Manage Processes on Linux

1 min read .
View and Manage Processes on Linux

A Linux process is a running instance of a program. Process-management tools help you inspect CPU and memory use, identify stuck applications, send signals, and manage foreground or background jobs.

Inspect Processes with ps

ps
ps -e
ps aux

ps aux is a common BSD-style view that includes the owning user, PID, CPU, memory, and command.

For a specific program, pgrep is often cleaner than piping ps through grep:

pgrep -a nginx

Monitor Processes Interactively

top

top continuously updates process and system metrics.

htop provides a more interactive interface when installed:

sudo apt install htop        # Debian/Ubuntu
sudo dnf install htop        # Fedora/RHEL-family systems where available
htop

Send Signals with kill

The default signal from kill is SIGTERM, which asks a process to terminate cleanly:

kill PID
# equivalent to:
kill -TERM PID

If a process does not respond and you understand the consequences, SIGKILL forces the kernel to stop it immediately:

kill -KILL PID

Use SIGKILL as a last resort because the process cannot perform cleanup or flush application state.

To signal processes by name:

pkill process_name

Be careful with broad name-based commands on shared systems.

Shell Jobs

Start a command in the background:

command &

List jobs created by the current shell:

jobs

Bring a job back to the foreground:

fg %1

Shell jobs are different from all system processes; jobs only knows about jobs managed by the current shell.

Conclusion

Use ps or pgrep for snapshots, top or htop for live monitoring, and signals such as SIGTERM for controlled shutdown. Escalate to SIGKILL only when graceful termination has failed.

Related Posts

chevron-up