βοΈ 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.
FAQs (0)
Sign in to ask a question. You can read FAQs without logging in.