A process is an instance of a program running in an operating system. Process management involves monitoring, controlling, and manipulating processes.
ps
ps
is used to list running processes.
ps -aux
-a
: All users.-u
: List users and other details.-x
: Include processes without terminals.ps -u username
top
top
is an interactive tool for monitoring processes in real-time.
top
Displayed information:
PID
: Process ID.USER
: Process owner.%CPU
: CPU usage.%MEM
: Memory usage.kill
Used to stop a process by sending a signal.
kill PID
kill -9 PID
-9
: Signal to stop the process forcibly.htop
htop
is an alternative to top with a friendlier interface.
sudo zypper install htop
htop
vmstat
commandvmstat provides information about CPU, memory, and I/O.
vmstat 1
Displays statistics every 1 second
mpstat
commandmpstat is used to monitor CPU usage per core.
sudo zypper install sysstat
mpstat -P ALL
sar
commandsar records CPU usage statistics.
sar -u 1 5
Description:
-u
: CPU statistics.1 5
: Every 1 second, 5 times.free
commandfree is used to view memory usage.
free -h
Description:
-h
: Displays the size in easy-to-read format (GB/MB).
vmstat
command
In addition to CPU, vmstat also provides memory information.
Run:
vmstat 1
sysctl is used to change kernel parameters.
sysctl -a
sudo sysctl -w vm.swappiness=10
/etc/sysctl.conf
:vm.swappiness=10
sudo sysctl -p
sudo zypper install iotop
iotop
XFS
or Btrfs
for high performance.sudo cpulimit -l 50 -p PID
Description :
-l
: CPU limit in percent.Swap is a space on the disk that is used as additional memory when RAM is full.
swapon –show
free -h
sudo fallocate -l 1G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
/etc/fstab
for automatic activation:/swapfile swap swap defaults 0 0
Swappiness determines how often the system uses swap.
cat /proc/sys/vm/swappiness
sudo sysctl vm.swappiness=10
/etc/sysctl.conf
:vm.swappiness=10