Aller au contenu

btop - Moniteur de Ressources Moderne

btop est un moniteur de ressources moderne et multiplateforme qui affiche l’utilisation et les statistiques du processeur, de la mémoire, des disques, du réseau et des processus. Il est conçu comme un remplacement de htop avec des fonctionnalités améliorées et une présentation visuelle plus attrayante.

Installation

Ubuntu/Debian

# Install from package manager (Ubuntu 22.04+)
sudo apt update
sudo apt install btop

# Install from snap
sudo snap install btop

# Build from source
sudo apt install build-essential git cmake
git clone https://github.com/aristocratos/btop.git
cd btop
make
sudo make install
```Pour installer btop sur Ubuntu/Debian, utilisez la commande suivante :
```bash
sudo apt update
sudo apt install btop

CentOS/RHEL/Fedora

# Fedora
sudo dnf install btop

# CentOS/RHEL (EPEL required)
sudo yum install epel-release
sudo yum install btop

# Build from source
sudo yum groupinstall "Development Tools"
sudo yum install git cmake gcc-c++
git clone https://github.com/aristocratos/btop.git
cd btop
make
sudo make install
```Pour installer btop sur CentOS/RHEL/Fedora, utilisez :
```bash
sudo dnf install btop

macOS

# Using Homebrew
brew install btop

# Using MacPorts
sudo port install btop

# Build from source
git clone https://github.com/aristocratos/btop.git
cd btop
make
sudo make install
```Sur macOS, installez btop via Homebrew :
```bash
brew install btop

Arch Linux

# Install from official repository
sudo pacman -S btop

# Install from AUR
yay -S btop-git
```Sur Arch Linux, utilisez votre gestionnaire de paquets AUR :
```bash
yay -S btop

FreeBSD

# Install from ports
sudo pkg install btop

# Build from ports
cd /usr/ports/sysutils/btop
sudo make install clean
```Sur FreeBSD, installez btop avec :
```bash
pkg install btop

Utilisation de Base

Démarrer btop

# Start btop with default settings
btop

# Start with specific theme
btop --theme Default

# Start in minimal mode
btop --minimal

# Start with specific update interval
btop --update 1000

# Start with debug logging
btop --debug
```Pour démarrer btop, tapez simplement dans votre terminal :
```bash
btop

Options de Ligne de Commande

# Display help
btop --help
btop -h

# Show version information
btop --version
btop -v

# Use specific configuration file
btop --config /path/to/config

# Start in low-color mode
btop --low-color

# Start with UTF-8 disabled
btop --no-unicode

# Start with specific log level
btop --loglevel INFO
```Quelques options de ligne de commande utiles :
- `btop --help` : Affiche l'aide
- `btop --version` : Affiche la version

## Navigation dans l'Interface

### Raccourcis Clavier
```bash
# General Navigation
q, Ctrl+c, Esc    # Quit btop
h, F1             # Show help
+, -              # Add/remove boxes
Tab               # Toggle between CPU and memory graphs
Shift+Tab         # Reverse toggle

# Process Control
k                 # Kill selected process
t                 # Tree view toggle
r                 # Reverse sorting order
c                 # Toggle command/name display
delete            # Clear process search
/                 # Start process search
n                 # Next search result
N                 # Previous search result

# View Controls
m                 # Toggle memory unit (KB, MB, GB)
d                 # Toggle disk unit display
n                 # Toggle network unit display
y                 # Toggle sync mode
z                 # Toggle zero values
a                 # Toggle auto-scaling graphs
g                 # Toggle GPU stats (if available)

# Process Sorting
F5, s             # Sort by PID
F6, S             # Sort by program name
F7, c             # Sort by CPU usage
F8, m             # Sort by memory usage
```Principaux raccourcis clavier :
- `Flèches` : Navigation
- `Entrée` : Sélectionner/Développer
- `Échap` : Retour/Quitter

### Contrôles Souris
```bash
# Mouse Support (if enabled)
Mouse wheel       # Scroll process list
Left click        # Select process
Right click       # Process context menu
Double click      # Process details
```btop supporte les interactions à la souris :
- Clic gauche : Sélection
- Défilement : Navigation
- Double-clic : Actions contextuelles

## Configuration

### Emplacement du Fichier de Configuration
```bash
# Linux
~/.config/btop/btop.conf

# macOS
~/Library/Application Support/btop/btop.conf

# Create default config
btop --create-config
```Le fichier de configuration se trouve généralement à :
`~/.config/btop/btop.conf`

### Options de Configuration
```ini
# btop.conf example configuration

# Color theme
color_theme = "Default"

# Update rate in milliseconds
update_ms = 2000

# Process sorting
proc_sorting = "cpu lazy"

# Process tree view
proc_tree = false

# Process command display
proc_colors = true
proc_gradient = true
proc_per_core = false

# CPU settings
show_cpu_freq = true
cpu_graph_upper = "total"
cpu_graph_lower = "total"
cpu_invert_lower = true
cpu_single_graph = false

# Memory settings
show_swap = true
swap_disk = true
show_disks = true
only_physical = true
use_fstab = true

# Network settings
net_download = 100
net_upload = 100
net_auto = true
net_sync = false
net_color_fixed = false

# Display settings
shown_boxes = "cpu mem net proc"
update_check = true
background_update = true
custom_cpu_name = ""
disks_filter = ""
mem_graphs = true
show_gpu_info = false

# Interface settings
vim_keys = false
rounded_corners = true
graph_symbol = "braille"
graph_symbol_cpu = "default"
graph_symbol_mem = "default"
graph_symbol_net = "default"
graph_symbol_proc = "default"
shown_boxes = "cpu mem net proc"
proc_left = false
cpu_bottom = false
show_uptime = true
check_temp = true
show_coretemp = true
temp_scale = "celsius"
show_cpu_freq = true
```Options principales :
- Personnalisation des graphiques
- Seuils de couleur
- Affichage des processus

### Thèmes
```bash
# Available themes
Default
Default_light
Gruvbox_dark
Gruvbox_light
Monokai
Nord
Solarized_dark
Solarized_light
TTY

# Custom theme creation
mkdir -p ~/.config/btop/themes
cp /usr/share/btop/themes/Default.theme ~/.config/btop/themes/custom.theme
# Edit custom.theme with your colors
```btop propose plusieurs thèmes prédéfinis :
- Default
- Monokai
- Solarized
- Nord

## Fonctionnalités Avancées

### Gestion des Processus
```bash
# Process filtering and searching
/                 # Start search
Esc               # Clear search
Enter             # Confirm search

# Process tree view
t                 # Toggle tree view
+/-               # Expand/collapse tree nodes

# Process details
Enter             # Show detailed process info
i                 # Show process I/O stats
o                 # Show process open files
l                 # Show process limits
e                 # Show process environment
```Fonctionnalités de gestion des processus :
- Tri
- Filtrage
- Arrêt de processus

### Surveillance Système
```bash
# CPU monitoring
1-9               # Show individual CPU cores
0                 # Show all CPU cores combined
Ctrl+L            # Toggle CPU frequency display

# Memory monitoring
m                 # Cycle through memory units
Shift+M           # Toggle memory graph type

# Disk monitoring
d                 # Toggle disk usage display
Shift+D           # Toggle disk I/O stats

# Network monitoring
n                 # Toggle network interface display
Shift+N           # Toggle network graph type
```Surveillance en temps réel de :
- Utilisation CPU
- Utilisation mémoire
- Activité réseau
- E/S disque

### Surveillance GPU (si supporté)
```bash
# GPU stats (NVIDIA/AMD)
g                 # Toggle GPU information
Shift+G           # Cycle GPU display modes

# GPU configuration in btop.conf
show_gpu_info = true
gpu_mirror_graph = true
check_gpu = true
```Surveillance GPU avec :
- Utilisation
- Température
- Mémoire

## Optimisation des Performances

### Paramètres d'Utilisation des Ressources
```ini
# Reduce update frequency for lower CPU usage
update_ms = 5000

# Disable expensive features
proc_tree = false
show_disks = false
check_temp = false
background_update = false

# Simplify display
graph_symbol = "block"
proc_gradient = false
rounded_corners = false
```Ajustez :
- Fréquence de rafraîchissement
- Précision des graphiques
- Filtres de processus

### Optimisation Mémoire
```bash
# Run with minimal memory footprint
btop --minimal

# Disable background updates
btop --no-update

# Use simple graph symbols
# Set graph_symbol = "block" in config
```Techniques d'optimisation :
- Limitation des processus affichés
- Réduction de la fréquence de rafraîchissement

## Intégration et Automatisation

### Scripting avec btop
```bash
#!/bin/bash
# Monitor system and log high CPU processes

btop --batch --iter 1|grep -E "CPU|MEM" > system_stats.log

# Export configuration
btop --print-config > btop_backup.conf

# Automated monitoring
while true; do
    btop --batch --iter 1 --delay 60 >> monitoring.log
    sleep 60
done
```Utilisez btop dans des scripts shell pour :
- Surveillance automatisée
- Logging de ressources
- Alertes système

### Surveillance à Distance
```bash
# SSH with btop
ssh user@remote-host btop

# Screen/tmux session
screen -S monitoring btop
tmux new-session -d -s monitoring btop

# Watch mode for continuous monitoring
watch -n 5 'btop --batch --iter 1'
```### Analyse des Logs
```bash
# Capture btop output
btop --batch --iter 10 > system_snapshot.txt

# Parse CPU usage
btop --batch --iter 1|grep "CPU"|awk '\\\\{print $2\\\\}'

# Monitor specific process
btop --batch|grep "process_name"
```## Dépannage
```bash
# Permission issues
sudo btop                    # Run with elevated privileges

# Terminal compatibility
export TERM=xterm-256color   # Set terminal type
btop --no-unicode           # Disable Unicode characters
btop --low-color            # Use basic colors

# Performance issues
btop --minimal              # Minimal interface
btop --update 5000          # Slower updates
```### Mode Débogage
```bash
# Enable debug logging
btop --debug --loglevel DEBUG

# Check log files
tail -f ~/.config/btop/btop.log

# Test configuration
btop --config /dev/null     # Run without config
btop --create-config        # Recreate default config
```### Compatibilité Système
```bash
# Check system requirements
uname -a                    # System information
echo $TERM                  # Terminal type
locale                      # Locale settings

# Test terminal capabilities
tput colors                 # Color support
tput cols; tput lines      # Terminal dimensions
```## Comparaison avec Autres Outils
```bash
# btop advantages
- Modern C++ codebase
- Better visual design
- GPU monitoring support
- More detailed process information
- Cross-platform consistency
- Active development

# htop advantages
- Lower resource usage
- Wider distribution availability
- More mature and stable
- Simpler configuration
```### btop vs htop
```bash
# btop advantages
- Interactive interface
- Real-time graphs
- Mouse support
- Process tree view
- Better process management
- Modern terminal features

# top advantages
- Universal availability
- Lower resource usage
- Scriptable output
- Minimal dependencies
```### btop vs top
```ini
# Custom theme file: ~/.config/btop/themes/custom.theme
theme[main_bg]="#1e1e2e"
theme[main_fg]="#cdd6f4"
theme[title]="#f38ba8"
theme[hi_fg]="#89b4fa"
theme[selected_bg]="#45475a"
theme[selected_fg]="#cdd6f4"
theme[inactive_fg]="#6c7086"
theme[graph_text]="#f9e2af"
theme[meter_bg]="#313244"
theme[proc_misc]="#f5c2e7"
theme[cpu_box]="#89b4fa"
theme[mem_box]="#a6e3a1"
theme[net_box]="#fab387"
theme[proc_box]="#f38ba8"
theme[div_line]="#6c7086"
theme[temp_start]="#a6e3a1"
theme[temp_mid]="#f9e2af"
theme[temp_end]="#f38ba8"
theme[cpu_start]="#89b4fa"
theme[cpu_mid]="#cba6f7"
theme[cpu_end]="#f38ba8"
theme[free_start]="#a6e3a1"
theme[free_mid]="#f9e2af"
theme[free_end]="#f38ba8"
theme[cached_start]="#89b4fa"
theme[cached_mid]="#cba6f7"
theme[cached_end]="#f38ba8"
theme[available_start]="#a6e3a1"
theme[available_mid]="#f9e2af"
theme[available_end]="#f38ba8"
theme[used_start]="#f38ba8"
theme[used_mid]="#fab387"
theme[used_end]="#f9e2af"
theme[download_start]="#89b4fa"
theme[download_mid]="#cba6f7"
theme[download_end]="#f38ba8"
theme[upload_start]="#a6e3a1"
theme[upload_mid]="#f9e2af"
theme[upload_end]="#f38ba8"
theme[process_start]="#f38ba8"
theme[process_mid]="#fab387"
theme[process_end]="#f9e2af"
```### Schéma de Couleurs Personnalisé
```ini
# High-performance monitoring configuration
update_ms = 1000
proc_sorting = "cpu lazy"
proc_tree = true
proc_colors = true
proc_gradient = true
show_cpu_freq = true
cpu_graph_upper = "total"
cpu_graph_lower = "total"
show_swap = true
show_disks = true
net_auto = true
shown_boxes = "cpu mem net proc"
graph_symbol = "braille"
rounded_corners = true
background_update = true
check_temp = true
show_uptime = true
```Ce guide complet de btop couvre l'installation, la configuration, l'utilisation et les fonctionnalités avancées. btop offre des capacités modernes de surveillance système avec une interface intuitive pour l'analyse de performances en temps réel et la gestion des processus.