Home

Awesome

Better adb shell.

This repo uses the options of mksh (the android default shell) to get a better shell.

Features

General

screenshot-of-prompt

ls aliases

More aliases

Installation

clone this repo:

git clone https://github.com/matan-h/adb-shell

Linux/macOS

chmod +x and run the adb-shell.sh file (it's a short file, highly recommend you go and read it [and possibly also the startup.sh file] before executing)

chmod +x adb-shell.sh
./adb-shell.sh

This will create the startup file for the mksh shell if it doesn't exist, and start the better adb shell.

To make this adb-shell globally accessible ether add this to your $PATH or add an alias to this file:

# add this to your .rc file
alias adb-shell="<PATH TO THIS REPO>/adb-shell.sh"

Windows

Run the adb-shell.ps1 script (it's a short file, highly recommend you go and read it [and possibly also the startup.sh file] before executing)

powershell -executionpolicy bypass -File .\adb-shell.ps1

To make this adb-shell globally accessible ether add this to your $PATH or add an alias to this file:

# add this to your powershell $PROFILE file (most likely $HOME\Documents\PowerShell\Microsoft.PowerShell_profile.ps1)
set-alias "adb-shell" "<PATH TO THIS REPO>\adb-shell.ps1"
<!-- TODO: There are better ways to deliver PS1 scripts than alias, since this requires setting the execution policy. -->

History experimental feature

history is disabled by default in the android shell build options.

However, It's possible to emulate that using the shell functions (e.g. write the last command to a history file after every command.) The history is currently in testing state. If you want to enable it, go to startup.sh and change ENABLE_EXPERIMENTAL_HISTORY to true. (then adb push startup.sh /sdcard/.adb/startup.sh) Please open a GitHub issue for any bug/problem/suggestion.

Advanced Installation

The adb-shell.sh/.ps1 just pushes startup.sh and starts adb shell with the config file. That means, you can skip this automated script, and configure it manually, using:

STARTUP=/sdcard/.adb/startup.sh
alias adb-shell="adb shell -t \"HOME='/sdcard' ENV='$STARTUP' sh -i\""

The startup.sh is actually .mksh file for android, so if you want to config it manually, you can.

When you want to apply changes, run the following command: adb push startup.sh $STARTUP

Contribute

On all errors, problems or suggestions please open a GitHub issue

If you found this script useful, it would be great if you could buy me a coffee:

<a href="https://www.buymeacoffee.com/matanh" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-blue.png" alt="Buy Me A Coffee" height="47" width="200"></a>