btop

repository·main·Indexed 13 days ago

https://github.com/aristocratos/btop

A high-performance, interactive system resource monitor written in C++23. It provides real-time visualization of CPU, memory, disk, network, and process activity, succeeding bashtop and bpytop. Features include a game-inspired menu system with full mouse support, GPU monitoring for NVIDIA, AMD, and Intel, and support for custom themes.

Tokens
10.2K
Snippets
34
Records
39
Agent score
96%

What's inside btop

  1. What is btop?

    main

    btop is a fast and responsive system resource monitor written in C++. It provides real-time usage statistics and graphs for:

    • Processors (CPU)
    • Memory
    • Disks (including IO activity and speeds)
    • Network (with auto-scaling usage graphs)
    • Processes
    • Battery status
    • GPUs (via optional dependencies)

    It is the C++ successor to bashtop and bpytop and features a game-inspired menu system with full mouse support (clicking highlighted keys and scrolling through process lists).

  2. Key features of btop

    main

    btop offers a highly interactive interface for system monitoring:

    • Process Management: Fast selection with UP/DOWN keys, detailed stats for selected processes, process filtering, tree view, and the ability to send signals to processes.
    • Interactive UI: Full mouse support, easy switching of sorting options, and a UI menu to change all configuration file options directly.
    • Visualizations: Auto-scaling network graphs, selectable symbols for graphs, and disk IO activity monitoring.
    • Customization: Support for custom presets and themes.
  3. Enable GPU monitoring

    main

    GPU monitoring is supported on Linux and macOS (Apple Silicon). It requires a btop binary built with the GPU_SUPPORT=true flag.

    Hardware Requirements:

    • NVIDIA: Requires official NVIDIA drivers (closed or open-source) and the nvidia-ml dynamic library.
    • AMD: Requires rocm_smi_lib.
    • Intel: Requires a working C compiler (if compiling from source) and permission to read from SYSFS. Use make setcap (preferred) or make setuid to grant necessary permissions.
  4. How to use GPU monitoring in btop

    main

    GPU monitoring is available on Linux but requires specific compilation steps (see Compilation Linux) because it relies on loading dynamic GPU libraries. Note that binaries provided on the release page and continuous builds typically do not have GPU support enabled.

    To manage GPU monitoring boxes in the UI, use the following keys:

    • 5: Show/hide GPU 1
    • 6: Show/hide GPU 2
    • 7: Show/hide GPU 3
    • 0: Show/hide GPU 4

    GPU stats and graphs can also be displayed within the CPU box in a less verbose format; this can be configured in the CPU options menu.

    Keys: 5, 6, 7, 0 (to show/hide GPU monitoring boxes)
  5. Configure GPU support during compilation

    main

    Btop++ supports Nvidia, AMD, and Intel IGPUs.

    Linux GPU Support

    • NVIDIA: Requires official NVIDIA drivers and the nvidia-ml dynamic library.
    • AMD: Uses the ROCm SMI library. If your distribution doesn't provide it, you can statically link it using RSMI_STATIC=true. This requires the ROCm SMI source code in lib/rocm_smi_lib (tested with version 5.6.x).

    Disabling GPU Support

    If you need to disable GPU support manually:

    • Make: make GPU_SUPPORT=false or make GPU_SUPPORT=<true|false>
    • CMake: cmake -DBTOP_GPU=false or cmake -DBTOP_GPU=<ON|OFF>

    Warning: GPU support for Nvidia or AMD will not work when statically linking glibc or musl.

    # To statically link ROCm SMI for AMD support
    git clone https://github.com/rocm/rocm_smi_lib.git --depth 1 -b rocm-5.6.x lib/rocm_smi_lib
    make RSMI_STATIC=true
  6. Enable extended capabilities (setcap/setuid) for btop

    main

    To enable Intel GPU monitoring, CPU wattage monitoring, and to allow btop to send signals to any process or read /proc without permission issues, you must set extended capabilities or the suid bit.

    Using setcap (Linux)

    Run this after make install using the same PREFIX used during installation:

    sudo make setcap

    Using setuid (Linux/macOS)

    This makes btop run as a specific user (default is root).

    Linux:

    sudo make setuid

    macOS:

    sudo gmake setuid

    Note: For setuid, you can specify the user and group using SU_USER and SU_GROUP (defaults to root:root on Linux and root:wheel on macOS).

    sudo make setcap
    # or
    sudo make setuid
  7. Compile btop on OpenBSD using CMake

    main

    If you prefer CMake (community maintained), follow these steps on OpenBSD:

    1. Install build dependencies (Requires GCC, CMake, Ninja, Lowdown, and Git):
      pkg_add cmake git ninja lowdown
    2. Clone and enter the repository:
      git clone https://github.com/aristocratos/btop.git && cd btop
    3. Configure and Build:
      # Configure
      cmake -B build -G Ninja
      # Build
      cmake --build build
    4. Install:
      cmake --install build
      Note: CMake does not generate an uninstall target. To remove installed files, use: cat build/install_manifest.txt | xargs rm -irv
    cmake -B build -G Ninja
    cmake --build build
    cmake --install build
  8. Compile btop on Linux using CMake

    main

    To compile btop on Linux using the community-maintained CMake build system, ensure you have Clang/GCC, CMake, Ninja, Lowdown, and Git installed.

    Steps:

    1. Install dependencies (e.g., Debian Bookworm):
      sudo apt install cmake git g++ ninja-build lowdown
    2. Clone and enter the repository:
      git clone https://github.com/aristocratos/btop.git && cd btop
    3. Configure and Build:
      cmake -B build -G Ninja
      cmake --build build
    4. Install:
      cmake --install build
    sudo apt install cmake git g++ ninja-build lowdown
    git clone https://github.com/aristocratos/btop.git && cd btop
    cmake -B build -G Ninja
    cmake --build build
    cmake --install build
  9. Configure terminal requirements for optimal display

    main

    For the best visual experience, ensure your terminal supports:

    • 24-bit truecolor: Recommended.
    • 256-color: Supported via conversion if you set truecolor to False in options or use the -lc/--low-color flag.
    • 16-color TTY: Activated automatically on real TTY devices; can be forced with -t/--tty.
    • Wide characters: Required for proper rendering.
    • Unicode/Fonts: A UTF8 locale and a font supporting the following blocks are necessary for graphs:
      • Braille Patterns (U+2800 - U+28FF)
      • Geometric Shapes (U+25A0 - U+25FF)
      • Box Drawing and Block Elements (U+2500 - U+259F)

    Troubleshooting Text Rendering:

    • If graphs look incorrect, ensure your fallback font supports Braille characters (e.g., Terminess Powerline).
    • If text is misaligned in Konsole or Yakuake, try turning off "Bi-Directional text rendering".
  10. Uninstall btop

    main

    To remove btop from your system:

    Using Make (Linux/macOS)

    sudo make uninstall

    Using CMake

    CMake does not generate an uninstall target by default. To remove installed files, use the install manifest:

    cat build/install_manifest.txt | xargs rm -irv
    sudo make uninstall
    # or for CMake
    cat build/install_manifest.txt | xargs rm -irv
  11. Compile btop on Linux using Make

    main

    To compile btop from source on Linux using make, ensure you have GCC 14+ or Clang 19+, GNU coreutils, and sed installed.

    Steps:

    1. Install dependencies (e.g., Ubuntu 24.04):
      sudo apt install coreutils sed git build-essential lowdown
    2. Clone and enter the repository:
      git clone https://github.com/aristocratos/btop.git
      cd btop
    3. Compile:
      make
    4. Install:
      sudo make install
      Note: Use PREFIX=/target/dir to change the installation directory (default is /usr/local).
    sudo apt install coreutils sed git build-essential lowdown
    git clone https://github.com/aristocratos/btop.git
    cd btop
    make
    sudo make install
  12. Compile btop on macOS using Make

    main

    To compile btop on macOS using gmake, ensure you have GCC 14+ or Clang 19+, GNU coreutils, and sed installed. It is recommended to use Homebrew for dependencies.

    Steps:

    1. Install dependencies (via Homebrew):
      brew install coreutils make gcc@15 lowdown
    2. Clone and enter the repository:
      git clone https://github.com/aristocratos/btop.git
      cd btop
    3. Compile:
      gmake
    4. Install:
      sudo gmake install
    brew install coreutils make gcc@15 lowdown
    git clone https://github.com/aristocratos/btop.git
    cd btop
    gmake
    sudo gmake install