Resource monitoring in Linux

Sidharth ShuklaSidharth Shukla
3 min read

CPU Memory usage

  1. top – Real-time system summary.

  1. htop:- Interactive process viewer (advanced top).

  1. vmstat :- System memory, processes, paging, etc.

  1. free -h :- Memory usage in human-readable format.

  1. mpstat :- CPU usage (install via sysstat package).

  1. iostat :- CPU and disk I/O (also from sysstat).

  1. uptime :- How long the system has been running.

  1. lscpu :- CPU architecture info.

  1. numactl —hardware – NUMA node memory info.

  1. sar :- Collects, reports system activity (install sysstat).

Disk Usage and I/O

  1. df -h:- Disk space usage.

  1. du -sh :- Directory size

  1. lsblk :- List block devices.

  1. mount :- Mounted filesystems.

  1. findmnt :- Show mounted filesystems in tree.

  1. iostat :- Disk I/O statistics.

  1. iotop :- Real-time disk I/O. (need to use by super user)

  1. blktrace :- Trace block I/O.

dstat :- Versatile resource statistics.

Process and Services

  1. ps aux – List all running processes.

  1. pidstat – Process-level resource usage.

  1. systemctl status – Check service status.

  1. service – Manage system services (older systems).

Example of service command is like:- sudo service ssh status

  1. watch – Run commands repeatedly
    example :- watch [options] <Command> like:- watch df -h

Network Monitoring

  1. ip a – Show IP addresses.

  1. ss -tuln – Show listening ports.

  1. netstat -tulnp – (Old but still used).

  1. iftop – Real-time bandwidth monitor.

  1. nethogs – Bandwidth per process.

  1. traceroute – Trace network path
  • It maps the route packets take to reach a host.

  • Helps identify network delays or where a connection is failing.

  • Each line in the output = a router/hop between your system and the target.

  1. ping – Check network reachability.

  1. dig or nslookup – DNS lookup.

File and Log Monitoring

  1. tail -f /var/log/syslog – Real-time log monitoring.

  1. journalctl -xe – View systemd logs.

  1. lsof – List open files.

  1. inotifywait – Watch for file changes.

  2. stat – Detailed file info.
    command :- stat <filename>

Hardware Info

  1. lshw – List hardware info.

  2. lsusb – USB devices.

  3. lspci – PCI devices.

  4. dmidecode – BIOS/firmware info.

  5. sensors – Hardware temperature sensors.

General System Info

  1. uname -a – Kernel and system info

  2. hostnamectl – Host and OS details.

  3. dmesg | less – Kernel messages.

0
Subscribe to my newsletter

Read articles from Sidharth Shukla directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Sidharth Shukla
Sidharth Shukla

I am full stack web developer, currently i am learning devops and cloud technology.