Skip to content

btop - Modern Resource Monitor

btop is a modern, cross-platform resource monitor that shows usage and stats for processor, memory, disks, network, and processes. It's designed as a replacement for htop with enhanced features and better visual presentation.

Installation

Ubuntu/Debian

bash
# 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

CentOS/RHEL/Fedora

bash
# 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

macOS

bash
# 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

Arch Linux

bash
# Install from official repository
sudo pacman -S btop

# Install from AUR
yay -S btop-git

FreeBSD

bash
# Install from ports
sudo pkg install btop

# Build from ports
cd /usr/ports/sysutils/btop
sudo make install clean

Basic Usage

Starting btop

bash
# 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

Command Line Options

bash
# 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

Interface Navigation

Keyboard Shortcuts

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

Mouse Controls

bash
# Mouse Support (if enabled)
Mouse wheel       # Scroll process list
Left click        # Select process
Right click       # Process context menu
Double click      # Process details

Configuration

Configuration File Location

bash
# Linux
~/.config/btop/btop.conf

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

# Create default config
btop --create-config

Configuration Options

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

Themes

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

Advanced Features

Process Management

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

System Monitoring

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

GPU Monitoring (if supported)

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

Performance Optimization

Resource Usage Settings

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

Memory Optimization

bash
# Run with minimal memory footprint
btop --minimal

# Disable background updates
btop --no-update

# Use simple graph symbols
# Set graph_symbol = "block" in config

Integration and Automation

Scripting with 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

Remote Monitoring

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'

Log Analysis

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"

Troubleshooting

Common Issues

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

Debug Mode

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

System Compatibility

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

Comparison with Other Tools

btop vs htop

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 top

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

Advanced Configuration Examples

Custom Color Scheme

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"

Performance Monitoring Setup

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

This comprehensive btop cheatsheet covers installation, configuration, usage, and advanced features. btop provides modern system monitoring capabilities with an intuitive interface for real-time performance analysis and process management.