• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Root [HOW-TO] Get bash in Terminal Emulator

EarlyMon

The PearlyMon
Jun 10, 2010
57,583
70,387
New Mexico, USA
You may already have bash, but if not, this will give you one. Following that, methods are shown to have it as your default shell in Terminal Emulator and deploy a bashrc startup file.

Please make a nandroid backup before tinkering with this.

First, download bash from -

How to cross-compile BASH for Android | Roy Cormier


If your browser opens a page of gobbletygook, go back, long press the "HERE" link, and choose Save Link.

It may save as bash-arm.txt or bash-arm.bin with your browser. Use EStrongs File Explorer to rename to just bash-arm without the extension.

Next, use EStrongs to give you Root Explorer privilege and mount /system r/w for writing.

Move or copy bash-arm to /system/xbin and then go there and long press the name, Properties, and set permissions to rwxr-xr-x.

Open Terminal Emulator, enter the following commands exactly -

su
cd /system/bin
ln -s /system/xbin/bash-arm bash
exit


Go into Terminal Emulator Preferences and set the following command line -

/system/xbin/bash-arm -

Set initial command to -

export PATH=/data/local/bin:$PATH; source /sdcard/bash/bashrc

Create the bash folder under /sdcard, use EStrongs for that.

Create the file bashrc in /sdcard/bash and copy/paste the following into it -

Code:
#!/system/xbin/bash-arm

alias ll="ls -l -a"
alias llm="ls -l -a | more"

PS1="[\w] \$ "
clear
echo "Welcome, bash!"

Restart Terminal Emulator to see the effect.

The soft link in /system/bin allows you to enter bash from an adb shell by just entering: bash

Note that this does not replace your /system/bin/sh like other methods, so it's completely safe and won't break any other Android scripts.

Enjoy. :)

Please make a nandroid backup before tinkering with this. ;)

Consider using with Hackers Keyboard for best results.

PS - this is entirely my own method, feel free to copy and share. :)
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones