Managing Linux Processes: Monitor, Control, and Optimize with ps, top, kill, and nice

Linux RSH Network November 30, 2025 2 mins read

Learn how to monitor and control running processes in Linux using essential commands like ps, top, kill, and nice. This guide explains foreground vs background jobs, PIDs, and how to adjust process priority for better system performance.

βš™οΈ What Is a Process in Linux?

A process is an active instance of a running program.
Every application or script you execute creates a process with a unique PID (Process ID).

Linux processes are categorized as:

  • Foreground (interactive):
    Visible and directly controlled in the terminal.

  • Background (non-interactive):
    Run silently without blocking your shell.

πŸ“Œ Example:
firefox runs in the foreground, while cron jobs run in the background.


πŸ“‹ Viewing Processes in Linux

The following commands help you inspect active processes and system load:

Common Process Viewing Commands

Command Purpose Example
ps aux List all running processes Shows PID, CPU%, MEM%
top Real-time resource monitor Interactive system view
htop Enhanced top (if installed) Color-coded, scrollable process list
pgrep Search processes by name pgrep nginx

 


πŸ›‘ Controlling Linux Processes

You can end, pause, or resume processes using these commands:

Process Control Commands

Command Purpose Example
kill PID Send signal (default: SIGTERM) kill 2345
kill -9 PID Force kill (SIGKILL) kill -9 2345
pkill name Kill by process name pkill chrome
jobs View background jobs Lists job IDs
fg %1 Bring job 1 to foreground Used for suspended jobs
bg %1 Resume job in background Runs silently

βš–οΈ Managing Process Priorities Using nice & renice

Linux uses nice values (−20 to +19) to adjust process priority.

  • Lower nice value = Higher priority

  • Higher nice value = Lower priority

Priority Tuning Commands

Command Purpose Example
nice -n 10 command Start a process with lower priority nice -n 10 ./backup.sh
renice -n 5 -p 1234 Change priority of running process Adjusts process 1234 to nice value 5

 


🧠 Pro Tips for Process Management

βœ” Use top or htop to quickly identify CPU/memory hogs
βœ” Use kill -9 only as a last resort
βœ” Avoid renicing system-critical services (e.g., sshd, systemd)
βœ” Run long scripts in background:
  ./script.sh &


πŸš€ What’s Next?

Post #5:
We’ll dive into Linux package management — using apt, yum, and dnf to install, update, and remove software safely.

Advertisement

R
RSH Network

39 posts published

Sign in to subscribe to blog updates