How to enable Android adb shell history with up / down keys in under Linux? How to enable Android adb shell history with up / down keys in under Linux? android android

How to enable Android adb shell history with up / down keys in under Linux?


You can run the shell inside rlwrap:

rlwrap adb shell

I prefer to run it in an Emacs shell buffer myself, I recommend this if you're not allergic to Emacs. Emacs is also nice for running adb logcat: you get a searchable history and the messages are updated as they come, and you can easily put interesting patterns in color (M-x highlight-regexp and friends).


If you're talking about real device (not emulator), you should try some non-official firmwares, such as Cyanogenmod - it includes much better binary tools, such as much more featureful shell, sane set of regular UNIX tools, ssh server, etc.

If you're talking about emulator, you can extract these binaries from firmwares and push it into emulator as is (using a memory card image).


If Ctrl-p still gives you previous history entries, then it's possible that the arrow keys became unbound for some reason. Try this:

bind '"\e[A": previous-history'bind '"\e[B": next-history'

If that makes the arrow keys work, you can make it persistent by adding these two lines to /etc/inputrc or ~/.inputrc:

"\e[A": previous-history"\e[B": next-history