sadb is a powerful wrapper for Android Debug Bridge (adb) that simplifies multi-device management and command automation.
- π± Smart Device Selection: Automatically prompts for device selection when multiple devices are connected. Supports
fzffor fuzzy searching. - β‘ Batch Execution: Run a single command on ALL connected devices simultaneously.
- π Command Aliases: Define short aliases for complex adb commands (e.g.,
sadb alias log "logcat -v time"). - π οΈ Custom Methods: Create powerful multi-line scripts combining
adband local shell commands with automatic device targeting. - π― Active Device Lock: Lock onto a specific device serial for the current session to skip selection prompts.
- π¨ Modern UI: Beautifully formatted tables with status-based coloring and clear execution headers.
Download the sadb script and set the execution permission:
# For system-wide install (requires sudo):
sudo curl -L https://raw.githubusercontent.com/UncleBrook/sadb/main/sadb -o /usr/local/bin/sadb
sudo chmod +x /usr/local/bin/sadb
# For user-only install (ensure ~/.local/bin is in your PATH):
mkdir -p ~/.local/bin
curl -L https://raw.githubusercontent.com/UncleBrook/sadb/main/sadb -o ~/.local/bin/sadb
chmod +x ~/.local/bin/sadbDownload the completion script and load it in your shell configuration:
For Bash:
- Download the script:
mkdir -p ~/.config/sadb curl -L https://raw.githubusercontent.com/UncleBrook/sadb/main/sadb-completion.bash -o ~/.config/sadb/sadb-completion.bash
- Add the following to your
~/.bashrc:[[ -f ~/.config/sadb/sadb-completion.bash ]] && source ~/.config/sadb/sadb-completion.bash
For Zsh:
- Download the script:
mkdir -p ~/.config/sadb curl -L https://raw.githubusercontent.com/UncleBrook/sadb/main/sadb-completion.bash -o ~/.config/sadb/sadb-completion.bash
- Add the following to your
~/.zshrc:autoload -Uz bashcompinit && bashcompinit source ~/.config/sadb/sadb-completion.bash
Add an alias to your shell configuration (~/.bashrc or ~/.zshrc) to use sadb as a drop-in replacement for adb:
alias adb="sadb"If you prefer an automated setup, use the installation script which handles everything above for you:
curl -s https://raw.githubusercontent.com/UncleBrook/sadb/main/install.sh | bashsadb has been verified to work on WSL (Windows Subsystem for Linux) with the Windows adb.exe β you don't need a separate Linux build of adb inside WSL.
- Windows 10/11 with WSL installed (WSL 1 or WSL 2)
- Windows Platform Tools (contains
adb.exe)
Download Platform Tools for Windows and extract it to a folder such as C:\platform-tools.
Add the following line to ~/.bashrc or ~/.zshrc inside WSL:
export PATH="$PATH:/mnt/c/platform-tools"Adjust
/mnt/c/platform-toolsto match the actual location where you extracted Platform Tools (e.g./mnt/d/tools/platform-tools).
Then reload your shell:
source ~/.bashrc # or: source ~/.zshrcInstall sadb inside WSL using any Linux method above:
curl -s https://raw.githubusercontent.com/UncleBrook/sadb/main/install.sh | bashwhich adb # should point to /mnt/c/platform-tools/adb.exe
sadb devices # lists the devices connected through Windowssadbinvokes the Windowsadb.exe, which talks to the adb server running on Windows, so USB devices are managed by Windows β no extra setup (usbipd, etc.) is needed inside WSL.sadbautomatically strips the Windows CRLF line endings fromadb.exeoutput, so device lists and serial numbers are always parsed correctly.
- Keep WSL and Windows on the same Platform Tools version.
- If the adb server is not running yet, run
sadb start-serveronce to launch the Windows adb server. - Instead of editing
PATH, you can symlinkadb.exeinto your LinuxPATH:sudo ln -s /mnt/c/platform-tools/adb.exe /usr/local/bin/adb
sadb supports all standard adb commands and adds several powerful management features.
The alias command allows you to manage short commands and complex methods.
| Command | Description |
|---|---|
sadb alias -l -s [mode] |
List and sort aliases/methods (a|alpha, r|reverse, l|length) |
sadb alias -r <key> |
Remove a specific alias or method |
sadb alias -h, --help |
Display detailed help for the alias command |
sadb alias <key> <value> |
Add or update a command alias |
sadb alias.<key> <value> |
Shorthand to add a command alias |
sadb alias <key> |
Show the definition of a specific alias |
Set an active device for the current terminal session only. This avoids selection prompts without affecting other windows.
| Command | Description |
|---|---|
sadb active |
Trigger interactive selection (or auto-select if only one device is connected) |
sadb active <serial> |
Lock the current session to a specific device serial |
sadb active -d |
Unlock and return to interactive selection mode |
sadb active -h |
Display detailed help for the active command |
sadb provides a modern, color-coded table for listing devices. Active devices for the current session are highlighted in yellow.
| Command | Description |
|---|---|
sadb devices |
List connected devices in a beautified table and highlight the active device |
Commands like start-server, kill-server, connect, pair, version, etc., are passed directly to the original adb binary.
If multiple devices are connected, simply run any adb command:
sadb shellIf fzf is installed, you can search and select your device instantly.
sadb active # Select a device to lock onto for this terminal session
sadb devices # See the list with the active device highlighted
sadb active -d # Unlock and return to interactive selection mode# Create an alias
sadb alias ws "wm size"
# Use it
sadb wsDefine complex workflows in ~/.config/sadb/.alias:
# Example Method
my_workflow() {
local scale=$1
echo "Starting workflow..."
adb shell settings put global window_animation_scale $scale
adb shell settings put global transition_animation_scale $scale
adb shell settings put global animator_duration_scale $scale
echo "Workflow complete!"
}sadb automatically injects ANDROID_SERIAL, so you don't need -s inside methods.
- Bash v4.0+ (Required for associative arrays)
- adb (Android SDK Platform-Tools)
- fzf (Optional, for better interactive experience)
- WSL +
adb.exe(Optional, on Windows β see Windows (WSL) Usage)
This project is licensed under the Apache License 2.0.


