DEV Community

kingyou
kingyou

Posted on

Essential Linux Commands for System Monitoring and Performance Analysis

Hardware & System Information

lshw - List Hardware

lshw

Displays detailed hardware information including CPU, memory, storage, and devices.


Performance Analysis & Monitoring

iostat - I/O Statistics (sysstat)

iostats

Reports CPU and input/output statistics for devices and partitions. Useful for identifying disk I/O bottlenecks.

sar - System Activity Reporter

sar 5 5

Collects, reports, and saves system activity information. The command above runs 5 samples at 5-second intervals.

vmstat - Virtual Memory Statistics

vmstat -s

Reports memory statistics including virtual memory, physical memory, and swap usage.

swapon - Show Swap Information

swapon --show

Displays active swap spaces and their usage.


Networking

ifconfig - Network Configuration (net-tools)

ifconfig

Shows network interface configuration and status. Note: ip command is the modern alternative.

arp - Address Resolution Protocol

arp

Displays ARP table showing MAC addresses mapped to IP addresses.

netstat - Network Statistics

netstat -tulpn

Shows all TCP and UDP sockets in listening state with associated processes.

netstat -rn

Displays the kernel routing table.


Quick Reference

Command Purpose
lshw Hardware inventory
iostat Disk I/O statistics
sar 5 5 System activity (5 samples, 5s intervals)
vmstat -s Virtual memory summary
swapon --show Active swap spaces
ifconfig Network interface config
arp ARP table (IP-MAC mappings)
netstat -tulpn Listening ports & processes
netstat -rn Routing table

Modern Alternatives

For newer systems, consider these alternatives:

  • lshwlsblk, lscpu
  • ifconfigip addr show
  • arpip neigh
  • netstatss, ip route

Top comments (0)