Convert Figma logo to code with AI

aristocratos logobashtop

Linux/OSX/FreeBSD resource monitor

10,757
549
10,757
58

Top Related Projects

2,744

A terminal based graphical activity monitor inspired by gtop and vtop

26,263

Glances an Eye on your system. A top/htop alternative for GNU/Linux, BSD, Mac OS and Windows operating systems.

6,293

htop - an interactive process viewer

9,693

System monitoring dashboard for terminal

9,759

Yet another cross-platform graphical process/system monitor.

Quick Overview

Bashtop is a resource monitor for Linux and macOS that displays usage and stats for processor, memory, disks, network, and processes. It features a responsive terminal UI with real-time updates, mouse support, and a customizable interface. Bashtop is written in bash and aims to be both visually appealing and informative.

Pros

  • Visually appealing and customizable interface
  • Real-time updates and responsive UI
  • Comprehensive system monitoring (CPU, memory, disks, network, processes)
  • Mouse support for easy navigation and interaction

Cons

  • Limited to bash-compatible systems (Linux and macOS)
  • May have higher resource usage compared to simpler monitoring tools
  • Requires a color-capable terminal for optimal display
  • Some advanced features may require additional dependencies

Getting Started

To install and run Bashtop:

  1. Clone the repository:

    git clone https://github.com/aristocratos/bashtop.git
    
  2. Change to the bashtop directory:

    cd bashtop
    
  3. Run the script:

    ./bashtop
    

Alternatively, you can install Bashtop using package managers on supported systems:

  • On Ubuntu/Debian:

    sudo add-apt-repository ppa:bashtop-monitor/bashtop
    sudo apt update
    sudo apt install bashtop
    
  • On macOS with Homebrew:

    brew install bashtop
    

Once installed, simply run bashtop in your terminal to start the application. Use the menu at the top of the screen to navigate and configure the tool. Press 'q' or 'Esc' to quit the application.

Competitor Comparisons

2,744

A terminal based graphical activity monitor inspired by gtop and vtop

Pros of gotop

  • Written in Go, potentially offering better performance and cross-platform compatibility
  • Simpler and more lightweight interface
  • Easier to install on systems without Bash or Python

Cons of gotop

  • Less feature-rich compared to bashtop
  • Limited customization options
  • Fewer system metrics displayed

Code Comparison

bashtop (Bash):

get_cpu_usage() {
    cpu_usage=$(grep 'cpu ' /proc/stat | awk '{usage=($2+$4)*100/($2+$4+$5)} END {print usage}')
    echo "${cpu_usage%.*}"
}

gotop (Go):

func (p *Process) CPUPercent() float64 {
    cpuTimes := p.Times()
    now := time.Now()
    percent := 100 * (cpuTimes.Total() - p.lastCPUTimes.Total()) / now.Sub(p.lastCPUTime).Seconds()
    p.lastCPUTimes = cpuTimes
    p.lastCPUTime = now
    return percent
}

Both projects aim to provide system monitoring tools with real-time updates. bashtop offers a more comprehensive set of features and a highly customizable interface, while gotop focuses on simplicity and cross-platform compatibility. The choice between them depends on the user's specific needs and system requirements.

26,263

Glances an Eye on your system. A top/htop alternative for GNU/Linux, BSD, Mac OS and Windows operating systems.

Pros of Glances

  • Cross-platform support (Linux, macOS, Windows)
  • Extensive plugin system for customization
  • Web-based interface option

Cons of Glances

  • Less visually appealing interface
  • Higher resource usage

Code Comparison

Glances (Python):

def get_stats():
    stats = {}
    stats['cpu'] = psutil.cpu_percent(interval=1)
    stats['memory'] = psutil.virtual_memory().percent
    return stats

Bashtop (Shell):

get_cpu_usage() {
    cpu_usage=$(grep 'cpu ' /proc/stat | awk '{usage=($2+$4)*100/($2+$4+$5)} END {print usage}')
    echo "${cpu_usage%.*}"
}

Summary

Glances offers broader platform compatibility and extensibility through plugins, making it suitable for diverse environments. It also provides a web interface option. However, Bashtop excels in visual appeal and resource efficiency. Glances uses Python for its implementation, while Bashtop relies on shell scripting, resulting in different approaches to system monitoring and resource usage calculation.

6,293

htop - an interactive process viewer

Pros of htop

  • Lightweight and efficient, consuming minimal system resources
  • Widely available and pre-installed on many Linux distributions
  • Stable and well-established with a long development history

Cons of htop

  • Less visually appealing interface compared to bashtop
  • Fewer customization options for appearance and layout
  • Limited support for advanced system monitoring features

Code Comparison

htop:

void Process_writeCommand(Process* this, int writefd) {
    int saved_errno = errno;
    if (write(writefd, this->comm, PROCESS_COMM_LEN) < 0) {
        // Handle error
    }
    errno = saved_errno;
}

bashtop:

def get_proc_info():
    global proc, cpu_proc
    with open("/proc/stat", "r") as f:
        fields = [float(column) for column in f.readline().strip().split()[1:]]
        cpu_proc = fields
    return proc, cpu_proc

The code snippets demonstrate the different languages used (C for htop, Python for bashtop) and their approaches to process information handling. htop's C code focuses on low-level system interactions, while bashtop's Python code provides a higher-level abstraction for reading process statistics.

9,693

System monitoring dashboard for terminal

Pros of gtop

  • Lightweight and fast, with minimal system resource usage
  • Simple and clean interface, focusing on essential system information
  • Cross-platform compatibility (Linux, macOS, Windows)

Cons of gtop

  • Less detailed information compared to bashtop
  • Fewer customization options and themes
  • Limited configuration possibilities

Code Comparison

gtop (JavaScript):

const si = require('systeminformation');
const os = require('os');

si.cpu()
  .then(data => console.log(data))
  .catch(error => console.error(error));

bashtop (Bash):

get_cpu_usage() {
    local cpu_usage
    cpu_usage=$(grep 'cpu ' /proc/stat | awk '{usage=($2+$4)*100/($2+$4+$5)} END {print usage}')
    echo "${cpu_usage%.*}"
}

gtop uses the systeminformation library for data collection, while bashtop relies on native system commands and file parsing. gtop's JavaScript implementation may be more portable across different operating systems, whereas bashtop's bash scripts are optimized for Unix-like systems.

Both tools aim to provide system monitoring capabilities, but gtop focuses on simplicity and cross-platform support, while bashtop offers more detailed information and customization options at the cost of increased complexity and system-specific optimizations.

9,759

Yet another cross-platform graphical process/system monitor.

Pros of bottom

  • Written in Rust, offering better performance and memory safety
  • Cross-platform support (Windows, macOS, Linux)
  • More customizable interface with themes and layout options

Cons of bottom

  • Larger binary size due to Rust compilation
  • Steeper learning curve for configuration compared to bashtop
  • Less visually appealing default layout

Code Comparison

bottom (Rust):

pub fn get_cpu_data_list() -> Vec<CPUData> {
    let mut cpu_data = Vec::new();
    let cpu_count = num_cpus::get();
    for _ in 0..cpu_count {
        cpu_data.push(CPUData::default());
    }
    cpu_data
}

bashtop (Bash):

get_cpu_info() {
    local cpu_info
    cpu_info=$(grep -E "^processor|^model name|^cpu MHz" /proc/cpuinfo)
    printf "%s\n" "$cpu_info"
}

Both projects aim to provide system monitoring functionality, but they differ in implementation languages and target platforms. bottom offers cross-platform support and potentially better performance due to Rust, while bashtop provides a more visually appealing default layout and simpler configuration. The code snippets demonstrate the difference in language complexity, with bottom using Rust's type system and bashtop relying on Bash scripting for data retrieval.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

bashtop

Linux OSX FreeBSD Usage Bash Python bashtop_version Build Status Donate Sponsor Coffee

C++ Version

18 September 2021

btop++

The C++ version of bashtop - btop++ is available.

Get it at https://github.com/aristocratos/btop

Index

Documents

CHANGELOG.md

CONTRIBUTING.md

CODE_OF_CONDUCT.md

Description

Resource monitor that shows usage and stats for processor, memory, disks, network and processes.

Features

  • Easy to use, with a game inspired menu system.
  • Fast and "mostly" responsive UI with UP, DOWN keys process selection.
  • Function for showing detailed stats for selected process.
  • Ability to filter processes.
  • Easy switching between sorting options.
  • Send SIGTERM, SIGKILL, SIGINT to selected process.
  • UI menu for changing all config file options.
  • Auto scaling graph for network usage.
  • Shows message in menu if new version is available
  • Shows current read and write speeds for disks
  • Multiple data collection methods which can be switched if running on Linux

Themes

Bashtop now has theme support and a function to download missing local themes from repository.

See themes folder for available themes.

The builtin theme downloader places the default themes in $HOME/.config/bashtop/themes. User created themes should be placed in $HOME/.config/bashtop/user_themes to be safe from overwrites.

Let me know if you want to contribute with new themes.

Support and funding

Bug fixes and updates might be slow during normal workdays since I work full time as an industrial worker and don't have much time or energy left during the week. I'm looking into ways of funding this project that would allow me to take off time from my day job to work on this.

Any advice on how to get funding for open source projects is very welcome!

Update

You can now sponsor this project through github, see my sponsors page for options.

Also added donation links for paypal and ko-fi.

Any support is greatly appreciated!

Prerequisites

Mac Os X

Will not display correctly in the standard terminal! Recommended alternative iTerm2

Will also need to be run as superuser to display stats for processes not owned by user.

Linux, Mac Os X and FreeBSD

For correct display, a terminal with support for:

Also needs a UTF8 locale and a font that covers:

  • Unicode Block “Braille Patterns” U+2800 - U+28FF
  • Unicode Block “Geometric Shapes” U+25A0 - U+25FF
  • Unicode Block "Box Drawing" and "Block Elements" U+2500 - U+259F

Notice

Dropbear seems to not be able to set correct locale. So if accessing bashtop over ssh, OpenSSH is recommended.

Dependencies

Linux, OSX and FreeBSD

bash (v4.4 or later) Script functionality will most probably break with earlier versions. Bash version 5 is highly recommended to make use of $EPOCHREALTIME variable instead of a lot of external date command calls.

GNU coreutils

GNU sed

Linux using /proc for data collection

GNU grep

ps from procps-ng (v3.1.15 or later)

GNU awk

OSX and FreeBSD or Linux using psutil for data collection

Python3 (v3.6 or later)

psutil python module (v5.7.0 or later)

Optionals for additional stats

(Optional OSX) osx-cpu-temp Needed to show CPU temperatures.

(Optional Linux) lm-sensors Needed to show CPU temperatures.

(Optional Linux) iostat (part of sysstat) Needed if you want disk read/write stats and are not using psutil data collection.

(Optional OSX/Linux/FreeBSD) curl (v7.16.2 or later) Needed if you want messages about updates and the ability to download themes.

Screenshots

Main UI showing details for a selected process. Screenshot 1

Main menu. Screenshot 2

Options menu. Screenshot 3

Installation

Dependencies installation OSX

Install homebrew if not already installed

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

If you got python 3.6 or later installed outside of brew:

sudo python3 -m ensurepip
sudo python3 -m pip install psutil

If you haven't got python3 installed:

brew install python3
python3 -m pip install psutil

Install dependencies

brew install bash coreutils gnu-sed git

Install optional dependency osx-cpu-temp

brew install osx-cpu-temp

Dependencies installation FreeBSD

Install with pkg and pip

sudo pkg install coreutils gsed git py37-psutil

Manual installation Linux, OSX and FreeBSD

Clone and install

git clone https://github.com/aristocratos/bashtop.git
cd bashtop
sudo make install

to uninstall it

sudo make uninstall

FreeBSD package

Available in FreeBSD ports

Install pre-built pacakge

sudo pkg install bashtop

Arch based

Available in the AUR as bashtop-git

Available in the Arch Linux repository as bashtop

Debian based

Available in official Debian repository since Debian 11

Available for debian/ubuntu from Azlux's repository

Or use quick installation:

Quick install go to DEB folder and type

 sudo ./build

to uninstall it go to DEB folder and type

 sudo ./build --remove

Guix based

Available in official Guix repository since 6bbd0fd2

Installation

guix install bashtop

Ubuntu based

Available in official Ubuntu repository since Ubuntu 20.10

Available for Ubuntu from PPA repository

Add PPA repository and install bashtop

 sudo add-apt-repository ppa:bashtop-monitor/bashtop
 sudo apt update
 sudo apt install bashtop

Fedora

Available in the Fedora repository.

Installation

sudo dnf install bashtop

CentOS 8

Installation

dnf config-manager --set-enabled PowerTools
dnf install epel-release
dnf install bashtop

RHEL 8

Installation

ARCH=$( /bin/arch )
subscription-manager repos --enable
"codeready-builder-for-rhel-8-${ARCH}-rpms"
dnf install epel-release
dnf install bashtop

Configurability

All options changeable from within UI. Config files stored in "$HOME/.config/bashtop" folder

bashtop.cfg: (auto generated if not found)

#? Config file for bashtop v. 0.9.21

#* Color theme, looks for a .theme file in "$HOME/.config/bashtop/themes" and "$HOME/.config/bashtop/user_themes"
#* Should be prefixed with either "themes/" or "user_themes/" depending on location, "Default" for builtin default theme
color_theme="Default"

#* Update time in milliseconds, increases automatically if set below internal loops processing time, recommended 2000 ms or above for better sample times for graphs
update_ms="2500"

#* Processes sorting, "pid" "program" "arguments" "threads" "user" "memory" "cpu lazy" "cpu responsive"
#* "cpu lazy" updates sorting over time, "cpu responsive" updates sorting directly
proc_sorting="cpu lazy"

#* Reverse sorting order, "true" or "false"
proc_reversed="false"

#* Show processes as a tree
proc_tree="false"

#* Check cpu temperature, only works if "sensors", "vcgencmd" or "osx-cpu-temp" commands is available
check_temp="true"

#* Draw a clock at top of screen, formatting according to strftime, empty string to disable
draw_clock="%X"

#* Update main ui when menus are showing, set this to false if the menus is flickering too much for comfort
background_update="true"

#* Custom cpu model name, empty string to disable
custom_cpu_name=""

#* Enable error logging to "$HOME/.config/bashtop/error.log", "true" or "false"
error_logging="true"

#* Show color gradient in process list, "true" or "false"
proc_gradient="true"

#* If process cpu usage should be of the core it's running on or usage of the total available cpu power
proc_per_core="false"

#* Optional filter for shown disks, should be names of mountpoints, "root" replaces "/", separate multiple values with space
disks_filter=""

#* Enable check for new version from github.com/aristocratos/bashtop at start
update_check="true"

#* Enable graphs with double the horizontal resolution, increases cpu usage
hires_graphs="false"

#* Enable the use of psutil python3 module for data collection, default on OSX
use_psutil="true"

Command line options: (not yet implemented)

USAGE: bashtop

TODO

Might finish off items out of order since I usually work on multiple at a time.

  • Add options to change colors for text, graphs and meters.

  • Fix cross platform compatibility for Mac OSX and *BSD: Working on OSX, and FreeBSD.

  • Add support for showing AMD cpu temperatures.

  • Add option to show tree view of processes.

  • Add option to reset network download/upload totals.

  • Add option to turn of gradient in processes list.

  • Add gpu temp and usage. (If feasible)

  • Add io stats for disks.

  • Add cpu and mem stats for docker containers. (If feasible)

  • Change process list to line scroll instead of page change.

  • Add optional window for tailing log files.

  • Add options for resizing all boxes.

  • Add command line argument parsing.

  • Builtin updater. Relevant PR #96 by Jukoo

  • Add support for zram in memory box. Relevant PR #122 by perkinslr

  • Miscellaneous optimizations and code cleanup.

  • Add more commenting where it's sparse.

  • Python port. (Porting started)

LICENSE

Apache License 2.0