How to Monitor System Resources (`htop`, `glances`) on Arch Linux
htop
, glances
) on Arch LinuxCategories:
5 minute read
Monitoring system resources is essential for maintaining the health, performance, and stability of any Linux system. Arch Linux, known for its simplicity and customization, provides a rich environment for users to tailor their monitoring tools to their needs. Two powerful and user-friendly utilities for this task are htop
and glances
. This article will guide you through installing, configuring, and using these tools effectively on Arch Linux.
Why Monitor System Resources?
System monitoring is critical for a number of reasons:
- Performance tuning: Identifying bottlenecks in CPU, memory, or disk usage.
- Troubleshooting: Pinpointing unresponsive processes or services that consume excessive resources.
- System health checks: Keeping an eye on temperature, load average, and memory usage to prevent overheating or system crashes.
- Security: Spotting unusual activity that may suggest a security breach.
Let’s explore two widely used tools that can help you achieve these goals: htop
and glances
.
1. Installing htop
on Arch Linux
What is htop
?
htop
is an interactive process viewer and system monitor that is a more feature-rich alternative to the classic top
command. It provides a colorful, real-time interface for viewing running processes, memory and CPU usage, and system load.
Installation
Installing htop
on Arch Linux is straightforward using pacman
:
sudo pacman -S htop
Once installed, you can launch it by simply running:
htop
2. Using htop
User Interface Overview
The htop
interface is divided into two main sections:
- Header (top part): Shows CPU (per core), memory, swap usage, and load averages.
- Process list (bottom part): Displays all running processes along with columns such as PID, user, CPU%, MEM%, uptime, and command.
Interactive Controls
One of the strengths of htop
is its interactive features. You can:
- Use arrow keys or
j/k
to navigate. - Press
F3
to search for a specific process. - Press
F4
to filter processes by name. - Press
F6
to sort by various columns (e.g., CPU usage, memory). - Press
F9
to kill a process (with signal selection). - Press
F10
to quit.
Customization
You can customize the interface by pressing F2
(Setup). Here, you can:
- Adjust what columns appear in the process list.
- Choose different color schemes.
- Configure meters to show detailed memory stats, IO activity, etc.
Monitoring CPU and Memory
CPU usage is shown per core, which is helpful on multi-core systems. The memory usage bar gives a visual representation of how RAM is allocated (used, buffers, cache).
3. Installing glances
on Arch Linux
What is glances
?
glances
is a cross-platform, curses-based system monitoring tool written in Python. It provides a holistic overview of your system in a single dashboard, including CPU, memory, disk I/O, network, sensors, and more. glances
aims to present as much information as possible without requiring user interaction.
Installation
To install glances
, you can use the official Arch repositories:
sudo pacman -S glances
Alternatively, for the latest version, you can install it via pip
(Python’s package manager):
pip install glances
Note: If using pip
, it is recommended to use a virtual environment or install it using pipx
.
4. Using glances
Starting glances
Just run:
glances
The default interface will open up in your terminal.
Interface Overview
The interface is divided into several sections:
- CPU and Load: Shows usage per core and load averages.
- Memory and Swap: Reports total, used, and free memory with percentages.
- Disk I/O: Displays read/write activity.
- Network: Shows incoming/outgoing traffic.
- Processes: List of top processes by CPU usage.
- Sensors (if available): Includes temperature and fan speed.
- File System: Disk space usage by mounted partitions.
Interactive Features
Although glances
is meant to be mostly passive, it still supports some keyboard commands:
q
: Quith
: Help menuc
: Sort processes by CPU usagem
: Sort by memory usagep
: Pause outputb
: Toggle network bandwidth in bits/bytes
Customization
Configuration is done via a file located at ~/.config/glances/glances.conf
, which allows you to:
- Toggle the visibility of different sections.
- Set thresholds for color-coded warnings.
- Enable/disable plugins (e.g., sensors, docker).
To generate a sample config file:
glances --generate-config
5. Comparison of htop
and glances
Feature | htop | glances |
---|---|---|
Interface | Highly interactive | Mostly static but comprehensive |
CPU/Memory info | Yes | Yes |
Network monitoring | Limited (requires plugins) | Built-in, more detailed |
Disk I/O | Basic (optional columns) | Built-in, detailed |
Process management | Advanced (kill, renice, etc.) | Basic sorting only |
Sensors (temp, etc.) | Via lm_sensors , optional setup | Built-in if dependencies met |
Logging | No | Yes (glances --export ) |
Web UI/API | No | Yes (glances -w ) |
Dependencies | Low | Python + psutil, netifaces, etc. |
6. Advanced Usage and Tips
Running in Web Mode (for glances
)
You can run glances
as a lightweight web server to monitor remotely:
glances -w
Then visit http://<your_ip>:61208
in a browser. You can also secure it using reverse proxy with Nginx and HTTPS.
Remote Monitoring (Client/Server)
Server
glances -s
Client (on another machine)
glances -c <server_ip>
Useful for managing multiple systems from a single terminal.
Logging with glances
You can export data in various formats:
glances --export-csv /path/to/file.csv
Or use other formats like JSON, InfluxDB, Prometheus, etc.
Minimal View
For focused monitoring:
glances --minimal
This is useful in small terminal windows or embedded setups.
7. Performance and Overhead
Both tools are designed to have minimal impact on system performance, but here are some notes:
htop
is extremely lightweight and perfect for real-time manual inspection.glances
is heavier due to Python but offers a broader view and is more suitable for automated and remote monitoring.
If you’re running on very limited hardware (e.g., Raspberry Pi), htop
might be the better choice unless you need the extended feature set of glances
.
8. Alternatives and Complementary Tools
Here are a few additional tools you might find useful:
iotop
– Monitor disk I/O by process.nmon
– Another real-time system performance monitoring tool.btop
– A modernhtop
/top
alternative with graphical enhancements.dstat
– Combinesvmstat
,iostat
, andnetstat
.vnstat
– Lightweight network traffic monitor.
Conclusion
Whether you’re a system administrator managing multiple servers, a power user tuning a desktop, or just someone curious about what’s going on inside your machine, htop
and glances
offer valuable insights into system health and performance.
- Use
htop
when you want a snappy, interactive, real-time view with powerful process management. - Use
glances
when you want a broad, automated overview or remote monitoring capabilities.
Since both tools are lightweight and easy to use, there’s no reason not to install both and switch depending on your current task.
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.