DEV Community

kingyou
kingyou

Posted on

Essential Linux Commands for System Monitoring and Performance Analysis

Hardware & System Information

lshw - List Hardware

lshw
Enter fullscreen mode Exit fullscreen mode

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


Performance Analysis & Monitoring

iostat - I/O Statistics (sysstat)

iostats
Enter fullscreen mode Exit fullscreen mode

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

sar - System Activity Reporter

sar 5 5
Enter fullscreen mode Exit fullscreen mode

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

vmstat - Virtual Memory Statistics

vmstat -s
Enter fullscreen mode Exit fullscreen mode

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

swapon - Show Swap Information

swapon --show
Enter fullscreen mode Exit fullscreen mode

Displays active swap spaces and their usage.


Networking

ifconfig - Network Configuration (net-tools)

ifconfig
Enter fullscreen mode Exit fullscreen mode

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

arp - Address Resolution Protocol

arp
Enter fullscreen mode Exit fullscreen mode

Displays ARP table showing MAC addresses mapped to IP addresses.

netstat - Network Statistics

netstat -tulpn
Enter fullscreen mode Exit fullscreen mode

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

netstat -rn
Enter fullscreen mode Exit fullscreen mode

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)