Skip to content

Instantly share code, notes, and snippets.

@SuggonM
Last active April 22, 2026 10:52
Show Gist options
  • Select an option

  • Save SuggonM/b11cc4e83425616a35795bf5a2ff52ee to your computer and use it in GitHub Desktop.

Select an option

Save SuggonM/b11cc4e83425616a35795bf5a2ff52ee to your computer and use it in GitHub Desktop.
Run bash and vim inside ADB shell

Why?

Because using the built-in mksh and editing text using pipes and redirects like a caveman is insanity!

Luckily, a kind stranger has already saved us the headache of cross-compiling :)

https://github.com/bnsmb/binaries-for-Android

Setup Instructions

Note

All commands displayed here are run inside ADB shell.

  1. cd to the special shell-owned path. This will be our $HOME1

    cd /data/local/tmp
  2. Get the bash and vim binaries from binaries-for-Android

    binaries="https://github.com/bnsmb/binaries-for-Android/raw/refs/heads/main/binaries"
    curl -LO $binaries/bash
    curl -L -o vim $binaries/vim-9.2  # select whichever version is available
  3. Make them executable and move to bin/

    chmod +x bash vim
    mkdir bin
    mv bash vim -t bin/
  4. Get .bashrc and .vimrc from this repo

    dots="https://github.com/SuggonM/dotfiles/raw/refs/heads/adb-shell"
    curl -LO $dots/.bashrc
    curl -LO $dots/.vimrc
    curl -LO $dots/_bash
    chmod +x _bash
  5. Get the Vim runtime

    curl -LO https://codeload.github.com/vim/vim/zip/refs/heads/master
    unzip master 'vim-master/runtime/*'
    mkdir -p sysroot/usr/share/vim
    mv vim-master/runtime sysroot/usr/share/vim
    rm -r master vim-master
  6. Run the bash wrapper to enter bash

    /data/local/tmp/_bash

Footnotes

  1. Unlike the name tmp suggests, it's persistent.

@SuggonM
Copy link
Copy Markdown
Author

SuggonM commented Apr 22, 2026

terminal-capture.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment