bdsh 0.1.4

Run commands on multiple hosts simultaneously via SSH with consensus output view
bdsh-0.1.4 is not a library.

bdsh

Better Distributed Shell - run commands on multiple hosts with a consensus view of the output.

Usage

bdsh host1,host2,host3 -- uname -a
bdsh @hosts.txt -- apt update
bdsh @"kubectl get nodes -o name" -- uptime

Host Sources

  • Inline: host1,host2,host3
  • File: @hosts.txt - one host per line, supports tags and comments
  • Command: @"command" - use output of command as host list

Tag Filtering

Hosts file can include tags:

web1 :web :prod
web2 :web :prod
db1 :db :prod
dev1 :web :dev

Filter with:

  • :web - hosts with tag
  • :web:prod - hosts with both tags (AND)
  • :web,:db - hosts with either tag (OR)
bdsh @hosts.txt :prod -- systemctl status nginx

Architecture

bdsh creates a tmux session with:

  • Window 0: Watch mode TUI showing consensus view of all output
  • Window 1-N: One window per host running ssh host command

Output is captured to $output_dir/$host/out.log via pipe-pane.

Watch Mode TUI

The consensus view shows output that's identical across hosts normally, and highlights differences:

[>2] Checking for upgrades...     <- 2 hosts differ, expandable
     [97] │ (0 candidates): 100%  <- 97 hosts have this
    host1 │ (1 candidates): 100%  <- 1 host differs

Keys

Key Action
↑↓ or j/k Scroll
→← or l/h Expand/collapse differences
Tab Jump to next difference
t Toggle tail mode (auto-scroll)
e/c Expand/collapse all
K Toggle keep output on exit
q Quit

Status Indicators

  • (spinner) - running
  • - success
  • - failed

Options

--watch <DIR>      Watch an output directory (standalone mode)
-o, --output-dir   Output directory (default: temp)
-k, --keep         Keep output directory on exit
--no-watch         Skip watch window, just run commands

Building

cargo build --release

Alternatives