YouTip LogoYouTip

Linux Comm Glances

Image 1: Linux Complete Command Reference Linux Command Encyclopedia

\n\n
\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\n

Main 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
\n\n

Install glances

\n\n

Ubuntu/Debian systems

\n\n

Example

\n\n
sudo apt update\n\nsudo apt install glances
\n\n

CentOS/RHEL systems

\n\n

Example

\n\n
sudo yum install epel-release\n\nsudo yum install glances
\n\n

Install using pip (all Linux distributions)

\n\n
pip install glances
\n\n
\n\n

Basic Usage

\n\n

The simplest way to start glances is to directly enter the command:

\n\n
glances
\n\n

After starting, you will see a dynamic monitoring interface similar to this:

\n\n
CPU[|||||||||||||||||||||||||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\n

In the glances running interface, you can use the following shortcuts:

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
ShortcutFunction Description
q or ESCExit glances
cSort processes by CPU usage
mSort processes by memory usage
iShow/hide I/O rate
dShow/hide disk I/O
nShow/hide network information
fShow/hide filesystem information
sShow/hide sensor information
wDelete warning logs
hShow help information
\n\n
\n\n

Important Command Line Options

\n\n

glances provides rich command line options to customize monitoring behavior:

\n\n

Display Control Options

\n\n

Example

\n\n
glances -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\n

Output Format Options

\n\n

Example

\n\n
glances --csv# CSV format output\n\n glances --json# JSON format output\n\n glances --export influxdb # Output to InfluxDB database
\n\n

Remote Monitoring Options

\n\n

Example

\n\n
glances -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\n

Example 1: Monitor specific process

\n\n
glances --process-name nginx # Only monitor nginx related processes
\n\n

Example 2: Generate system snapshot

\n\n
glances --export csv --export-csv-file /tmp/system_stats.csv
\n\n

Example 3: Set alert threshold

\n\n
glances --alert cpu:80,mem:90 # Alert when CPU exceeds 80% or memory exceeds 90%
\n\n

Example 4: Remote Web monitoring

\n\n

Example

\n\n
glances -w& # Start Web service\n\n firefox http://localhost:61208# View in browser
\n\n
\n\n

glances Configuration File

\n\n

The glances configuration file is usually located at ~/.config/glances/glances.conf, you can permanently modify the default settings by

← Linux Comm BpftraceLinux Comm Iotop β†’