![]() |
VOOZH | about |
Monitoring a Linux system means checking how well your computerβs hardware and software are working. It helps track performance, find resource-heavy processes, and detect issues early.
System information commands give details about your computerβs setup, including the operating system, kernel version, and hardware components. This information is useful for troubleshooting, system audits, and preparing for software installations.
Example 1. Displays system information in a tidy format, including OS name, kernel version, and virtualization details.
Command:
hostnamectl
Output:
What it does:
Example 2. Lists CPU information such as model name, number of cores, and threads.
Command:
lscpu
Output:
π fileWhat it does:
Example 3. Displays details about disks, partitions, and mount points in a clear table.
lsblk
What it does:
Example 4. Shows memory usage (RAM and swap) in human-readable units.
Command:
free -h
Reports RAM and swap usage with human-readable units, including total, used, free, and available memory.
Example 5. Tells you how much disk space is used and available on each mounted filesystem.
Command:
df -h
Output:
π fileWhat it does:
Performance monitoring shows how your system resources (CPU, memory, disk, network) are being used right now. It's handy for detecting lag, load, or bottlenecks.
Example 1. Shows live CPU and memory usage by processes, refreshing automatically.
top
What it does:
Example 2. A more colorful, user-friendly version of top where you can scroll and sort easily.
htop
What it does:
Example 3. Shows how busy your disks are and if any are overloaded.
iostat -xz 1
What it does:
Example 4. Displays real-time network usage in which connections are sending or receiving the most data.
Command:
iftop
Output:
What it does:
Sometimes, issues come from hardware rather than software. These commands help you find whatβs actually installed and working.
Example 1. Lists all PCI(Peripheral Component Interconnect) devices like graphics cards, network adapters, etc.
Command:
lspci
Output:
π fileWhat it does:
Example 2. Lists USB devices currently connected.
Command:
lsusb
Output:
What it does:
Example 3. Shows hardware details like manufacturer, model, and BIOS version.
sudo dmidecode -t system
Output:
π fileWhat it does:
Logs contain messages from the system and services, they explain why something went wrong.
Example 1. Shows recent system errors and warnings.
Command:
journalctl -xe
What it does:
Example 2. Displays logs related to a particular service.
Command:
journalctl -u servicename
What it does:
Example 3. Shows kernel messages (e.g., detected hardware, drivers, or crashes).
Command:
dmesg -T
What it does:
Linux uses services to run programs in the background (like web or database servers). You can check and control them easily.
Example 1. Shows if a service is running.
Command:
systemctl status service-name
What it does:
Example 2. Starts and enables the service to run at boot.
Command:
systemctl enable --now service-name
What it does:
Example 3. Lists services that have failed to start.
Command:
systemctl --failed
What it does:
Note: Some of these commands and outputs are intentionally omitted or may not run in certain environments due to privacy, permission, or security restrictions (e.g., sandboxed terminals, managed lab VMs, or limited user privileges).
Security begins by knowing whoβs logged in and what they can do.
Example 1. Displays current user ID and groups.
Command:
id
Output:
Example 2. Shows what commands the current user can run with sudo permissions.
Command:
sudo -l
Output:
Example 3. Lists the last 10 logins to your system.
Command:
last -n 10
Output:
You can automate system checks with a short script. Create a file called health.sh, paste this in, and run it with bash health.sh.
#!/usr/bin/env bash
echo "== SYSTEM =="
hostnamectl | egrep 'Operating System|Kernel|Architecture'
echo; echo "== CPU =="
lscpu | egrep 'Model name|CPU|Thread|Core|MHz'
echo; echo "== MEMORY =="
free -h
echo; echo "== DISK USAGE =="
df -hT | awk 'NR==1 || $7 ~ /^\/(home|var|root|\/|boot|data)/'
echo; echo "== NETWORK PORTS =="
ss -tuln | head -n 10
echo; echo "== LOAD AVERAGE (1/5/15) =="
awk '{print $1,$2,$3}' /proc/loadavg
echo; echo "== TOP PROCESSES =="
ps -eo pid,comm,%cpu,%mem --sort=-%cpu | head -n 10
This script summarizes the systemβs health helps in doing perfect quick check before troubleshooting or deployment.