
Learn how to view, control, and manage processes using Linux commands like ps
, top
, kill
, and systemctl
.
Before starting make sure ur linux is ready.
- Ubuntu: ubuntu.com/download
- Debian: debian.org/distrib
- CentOS Stream: centos.org/download
- AlmaLinux: almalinux.org/download
- Talkecho full toturial: Click here
Viewing Processes
To list running processes:
ps aux
For a live view of system activity:
top
Or a more modern interactive tool:
htop
(Install htop
on Debian/Ubuntu with sudo apt install htop
, or on CentOS/AlmaLinux with sudo yum install htop
.)
Stopping Processes
Kill a process by its PID:
kill 1234
Force kill:
kill -9 1234
Kill all instances of a program:
pkill firefox
Managing Services with systemctl
# check status
sudo systemctl status nginx
# start service
sudo systemctl start nginx
# stop service
sudo systemctl stop nginx
# restart service
sudo systemctl restart nginx
# enable on boot
sudo systemctl enable nginx
Changing Process Priority
Use nice
to start a process with priority:
nice -n 10 myscript.sh
Use renice
to adjust a running process:
renice -n 5 -p 1234
Running Processes in Background
# run in background
command &
# bring job to foreground
fg %1
# show background jobs
jobs