Why Glances is Better Than Top or Htop
Every Linux administrator is familiar with top and htop. While excellent tools, they primarily focus on CPU and RAM usage. Glances is a cross-platform, advanced system monitor written in Python. In a single, highly condensed terminal screen, Glances displays CPU, RAM, Swap, Disk I/O, Network speeds, Docker container stats, hardware temperatures, and even alerts for degraded RAID arrays. It is the ultimate “single pane of glass” for monitoring a Linux server’s real-time health.
Step 1: Install Glances via APT
While you can install Glances using Python’s pip package manager to get the absolute newest version, the version included in the default Ubuntu repositories is highly stable and much easier to manage.
Open your terminal and install the package:
sudo apt update
sudo apt install glances -y
Step 2: Launch and Navigate the Interface
To start monitoring, simply run the command:
glances
The interface is incredibly dense. The left side displays CPU and memory, the center displays network and disk I/O, and the right side displays running processes. At the very bottom, Glances keeps a running log of warnings (e.g., “CPU I/O wait is high”).
You can interact with the live interface using keyboard shortcuts:
Press c to sort processes by CPU.
Press m to sort by Memory.
Press d to toggle Disk I/O stats.
Press q to quit.
Step 3: Run Glances as a Web Server
One of the most powerful features of Glances is its built-in web server. You do not need to SSH into the server to view its health; you can view the terminal interface directly in your desktop web browser.
Start Glances in web server mode by appending the -w flag:
glances -w
The terminal will output: Glances Web User Interface started on http://0.0.0.0:61208/. Open your browser and navigate to your server’s IP address on port 61208 (e.g., http://192.168.1.50:61208) to see the live dashboard.
Step 4: Create a Systemd Service for the Web UI
Running the web server manually blocks your terminal session. To keep it running in the background permanently, create a systemd service file:
sudo nano /etc/systemd/system/glancesweb.service
Add the following configuration:
[Unit]
Description=Glances Web Server
After=network.target
Restart=on-abort [Install] WantedBy=multi-user.target
Step 5: Enable and Start the Service
Save the file and reload the systemd daemon so it recognizes your new service:
sudo systemctl daemon-reload
Enable the service to start automatically on boot, and start it immediately:
sudo systemctl enable --now glancesweb.service
Your Ubuntu server now has a permanent, lightweight, incredibly detailed health dashboard accessible from any web browser on your internal network.