better `adb shell`
adb shell
.This repo uses the options of mksh (the android default shell) to get a better shell.
ctrl+l
to clear the screen (in normal adb shell
it's a shortcut for 'enter' for some reason).CDPATH
: you can cd
to any directory in /sdcard
, Android/data
or /
without typing the full path
(for example cd com.android.chrome
even when you are in /
directory)ls
with color by default.ll
and la
.sl
=> ls
.rd
(rmdir
) and md
(mkdir
).cls
(clear the screen)rmtree
(remove folder)..
and cd..
=> cd ..
untar
(=> tar xvf
)clone this repo:
git clone https://github.com/matan-h/adb-shell
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"
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"
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.
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
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: