수. 8월 6th, 2025

Monitoring your Linux system is essential for maintaining performance, troubleshooting issues, and ensuring resource efficiency. Here’s an overview of powerful command-line tools that provide real-time insights into your system’s health:

1. Top & Htop – Process Monitoring

top is the classic real-time process viewer showing CPU/memory usage per process. Press M to sort by memory or P for CPU usage.
htop (install via sudo apt install htop) offers an enhanced interface with color-coding, vertical/horizontal scrolling, and mouse support. Perfect for quick process management.

2. vmstat – System Resource Overview

vmstat 2 5 (report every 2 seconds, 5 times) reveals:

  • Procs: Processes waiting (r) or blocked (b)
  • Memory: Swapping (si/so) and cache usage
  • CPU: User/system/idle time percentages
    Ideal for spotting bottlenecks in CPU, memory, or I/O.

3. iostat – Storage I/O Analysis

Part of the sysstat package (sudo apt install sysstat), run iostat -dx 3 to:

  • Monitor disk utilization (%util)
  • Track read/write throughput (rkB/s, wkB/s)
  • Identify I/O wait times (await)
    Crucial for diagnosing slow disk performance.

4. free – Memory Usage Snapshot

free -h displays in human-readable format:

  • Total/used/free RAM
  • Swap allocation
  • Buffers/cache utilization
    Add -s 5 for refreshing every 5 seconds.

5. nmon – All-in-One Monitor

Install with sudo apt install nmon. Launch and press:

  • c for CPU
  • m for Memory
  • d for Disks
  • n for Network
    Export data to CSV for later analysis with nmon -f -s 5.

6. Netstat/ss – Network Monitoring

netstat -tulpn shows active:

  • TCP/UDP connections (-t/-u)
  • Listening ports (-l)
  • Process IDs (-p)
    Modern alternative: ss -tunlp (faster, more detailed).

7. Glances – Dashboard-Style View

Install via pip install glances. Features:

  • Auto-adjusting color-coded metrics
  • Disk I/O, network, and sensor temps
  • Web UI support (glances -w)
    Press s to enable/disable sensors, c to sort processes.

8. Prometheus + Grafana (Bonus: Advanced)

For enterprise monitoring:

  • Prometheus collects/scrapes metrics
  • Node Exporter exposes hardware/OS data
  • Grafana visualizes via dashboards
    Ideal for historical analysis and alerts.

Pro Tips for Effective Monitoring:
🔹 Combine watch with tools (e.g., watch -n 1 free -h)
🔹 Log historical data with sar (sysstat)
🔹 Use atop for long-term process tracking
🔹 Always monitor disk space with df -h

Start with htop, glances, and nmon for immediate insights. For persistent issues, drill down with iostat and vmstat. Remember: Consistent monitoring prevents 90% of performance crises! 🐧💻

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다