\n\n
glances is a cross-platform command-line system monitoring tool that can display various performance metrics of Linux systems in an intuitive way. Compared with traditional top or htop commands, glances provides richer monitoring dimensions and a more user-friendly interface.
\n\nMain Features:
\n\n- \n
- Real-time monitoring of CPU, memory, disk, network and other core metrics \n
- Support for color display and dynamic refresh \n
- Can be accessed remotely via Web interface \n
- Low resource consumption, suitable for long-term running \n
- Support plugin extension function \n
\n\n
Install glances
\n\nUbuntu/Debian systems
\n\nExample
\n\nsudo apt update\n\nsudo apt install glances\n\nCentOS/RHEL systems
\n\nExample
\n\nsudo yum install epel-release\n\nsudo yum install glances\n\nInstall using pip (all Linux distributions)
\n\npip install glances\n\n\n\n
Basic Usage
\n\nThe simplest way to start glances is to directly enter the command:
\n\nglances\n\nAfter starting, you will see a dynamic monitoring interface similar to this:
\n\nCPU[|||||||||||||||||||||||||90.5%] RAM[|||||||||||||||||65.2%] SWAP[|3.1%]Load average: 1.78 1.23 0.89 NETWORK Rx/s Tx/s DISK I/O R/s W/s eth0 1.2Mb 560Kb sda 450Kb 1.2Mb wlan0 320Kb 120Kb sdb 0Kb 0KbProcesses: 156 total, 3 running, 153 sleeping\n\n\n\n
Common Shortcuts and Interactive Commands
\n\nIn the glances running interface, you can use the following shortcuts:
\n\n| Shortcut | \nFunction Description | \n
|---|---|
q or ESC | \nExit glances | \n
c | \nSort processes by CPU usage | \n
m | \nSort processes by memory usage | \n
i | \nShow/hide I/O rate | \n
d | \nShow/hide disk I/O | \n
n | \nShow/hide network information | \n
f | \nShow/hide filesystem information | \n
s | \nShow/hide sensor information | \n
w | \nDelete warning logs | \n
h | \nShow help information | \n
\n\n
Important Command Line Options
\n\nglances provides rich command line options to customize monitoring behavior:
\n\nDisplay Control Options
\n\nExample
\n\nglances -t 2# Set refresh interval to 2 seconds (default 1 second)\n\n glances --disable-plugins fs,ip# Disable filesystem and IP plugins\n\n glances --percpu# Display usage for each CPU core\n\nOutput Format Options
\n\nExample
\n\nglances --csv# CSV format output\n\n glances --json# JSON format output\n\n glances --export influxdb # Output to InfluxDB database\n\nRemote Monitoring Options
\n\nExample
\n\nglances -s# Start glances server mode\n\n glances -c@192.168.1.100 # Connect to remote glances server\n\n glances -w# Enable Web server mode (default port 61208)\n\n\n\n
Practical Application Examples
\n\nExample 1: Monitor specific process
\n\nglances --process-name nginx # Only monitor nginx related processes\n\nExample 2: Generate system snapshot
\n\nglances --export csv --export-csv-file /tmp/system_stats.csv\n\nExample 3: Set alert threshold
\n\nglances --alert cpu:80,mem:90 # Alert when CPU exceeds 80% or memory exceeds 90%\n\nExample 4: Remote Web monitoring
\n\nExample
\n\nglances -w& # Start Web service\n\n firefox http://localhost:61208# View in browser\n\n\n\n
glances Configuration File
\n\nThe glances configuration file is usually located at ~/.config/glances/glances.conf, you can permanently modify the default settings by
YouTip