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

Root [GUIDE] Installing Bash and Nano on Android

Sepero

Linux Guru
Aug 26, 2010
963
594
This guide is for installing Bash shell and Nano text editor on your device. Your device must be ROOTed, and this should work on just about any android device.

If you don't know what Bash or Nano are, then you probably don't want to install them. HUGE thanks to jmxp69 for originally posting this http://androidforums.com/evo-4g-all...shell-nano-tab-completion-color-over-ssh.html The binaries are over 2 years old, but bash and nano don't really change much over the years. They work great.

I have included a README.txt file to help with installing the binaries in case you have trouble.

Files included in the zip:
README.txt
bash v3.2.0
nano v2.0.9
profile
terminfo/

Quick install overview:

  1. Make sure /system is mounted as writable.
  2. Copy bash and nano to /system/xbin and set them as executable.
  3. Remove /system/bin/sh and recreate it as a symlink to /system/xbin/bash.
  4. Copy profile and terminfo/ to /system/etc/
  5. Edit the intial command in your terminal emulator to export terminfo. ";export TERMINFO=/system/etc/terminfo;export TERM=linux;"
  6. Get some scripting done with your new setup! :)


The included README.txt file gives more elaborate instructions, and command line examples for every step.

*************************
THESE TOOLS ARE FOR EXPERIENCED OR CURIOUS USERS OF THE LINUX TERMINAL. The Linux Terminal is similar to DOS, except about 1000 times more useful/powerful. Hackers use these tools like: echo, tar, grep, find, diff, cat, dd, du, sed, ps, chown, mount, for/while loops, and a hundred other things. Rooted Androids have these tools, and Bash provides a familiar interface to them.
*************************
 

Attachments

  • bashnano.zip
    1.5 MB · Views: 3,006
you can check and change files with bash.i dont know what he wants to use it for. its for pcs i thought.

Well its for anything running a linux environment actually (like androids). I would just wager a guess that this allows you far greater access to low and high level commands than simply having a teminal emulator and busybox would.
 
  • Like
Reactions: Sepero
Upvote 0
Well its for anything running a linux environment actually (like androids). I would just wager a guess that this allows you far greater access to low and high level commands than simply having a teminal emulator and busybox would.

2 what end. you have limits to what you can do.yes android is linux but its not a base architecture there wouldn't be any upside to running this on our phones that i can see. sometimes ppl like doing things because they can not because its helpful. imo this seems pointless.

ps. if i am wrong please tell me how.are phone is screwed as far as development so this is pointless.

pss. ppl are bored with the motion so the pointless crap we can and cant do will be coming up all the time.

that all seems a little harsh i just noticed. i am not going to erase it because i am going to apologize. i am no one to say what is or is not pointless. what do i know.
 
Upvote 0
For real examples- Having terminal access made all these Guides possible:

Maybe your sdcard is getting full. Want a listing of all your directories and their size, and ordered by size?
Type: du -s /mnt/sdcard/* | sort -g

Want to replace all instances of my "heavy boots" with "running shoes" in a file?
Type: sed -i 's/heavy boots/running shoes/g' file

Want to erase all traces of deleted files on your sdcard?
Type: cat /dev/zero > /mnt/sdcard/z; rm /mnt/sdcard/z

That's it! With No special magic Expensive software needed. The possibilities are endless for those who are knowledgeable.


On the other hand, a computer has no value to a person who doesn't know how to use it.
 
  • Like
Reactions: notty
Upvote 0
@ninjasinabag
It just surprises me at how easily people can dismiss something powerful that they don't understand. I mean no offense to anyone, but it gives me a mental picture of a caveman saying that an android phone doesn't make a very good hammer. I can't do anything but agree. In a way he is right, but I sigh, because the he has no idea of the other unlimited potentials.

Thanks for all the appreciation, it really means a lot to me. Also I apologize for any misunderstanding caused for people who might not grasp how to use these tools. If you think there is anyway I can improve the Original Post, please let me know.
 
  • Like
Reactions: aboatright
Upvote 0
Android is about personalization and usability, if there's something you need done or to do on an android phone, it can be done. By someone saying that a function is useless is like saying that the iPhone is better because of its casing alone.

Just because you can't find a use for an app/framework/function, doesn't mean that I won't be a game changer for another person.
 
  • Like
Reactions: aboatright
Upvote 0
Android is about personalization and usability, if there's something you need done or to do on an android phone, it can be done. By someone saying that a function is useless is like saying that the iPhone is better because of its casing alone.

Just because you can't find a use for an app/framework/function, doesn't mean that I won't be a game changer for another person.

all i am saying is we cant make backups we cant overclock the kernel we have limited theming abilities and so on. while guides,rooting and slight theming is nice i wish we had the ability to really make are phone what we want it to be. i did say i was being harsh and that i did not know a lot about bash.
 
Upvote 0
@nizlovelots
It's all good. Technically our phone comes pre-overclocked! (1.5Ghz) ;)

It's true we can't get CWM or Cyanogenmod... but with root and command line tools, we in fact can make (and restore) full system backups. hehe :D

Maybe I'll make a little Guide on that next. For someone familiar with these tools, it's a pretty simple task.
 
  • Like
Reactions: ninjasinabag
Upvote 0
@nizlovelots
It's all good. Technically our phone comes pre-overclocked! (1.5Ghz) ;)

It's true we can't get CWM or Cyanogenmod... but with root and command line tools, we in fact can make (and restore) full system backups. hehe :D

Maybe I'll make a little Guide on that next. For someone familiar with these tools, it's a pretty simple task.

you are a very helpful person. taking the time to help and make guides is very admirable. oh and 1.5 is great 1.8 would be better at least it would be in theory. i have seen overclocks hurt more then help sometimes.
 
Upvote 0
Overclocking can have many side effects on any piece of electronics. In cases like that of the lg connect 4g, over clocking could lead to wearing down of the battery in a frightening amount of time, hell I once had the oh so awesome experience to have the soldering melt and damn near nuke over in my hand...

i oc pcs all the time. what i was saying is in android sometimes oc doesnt even boost performance. the battery drain sucks but soldering melt from overheating that really sucks you must have been pissed.
 
Upvote 0
i oc pcs all the time. what i was saying is in android sometimes oc doesnt even boost performance. the battery drain sucks but soldering melt from overheating that really sucks you must have been pissed.

I can't be pissed about it, I knew what I was getting into by messing with it like that. I'm still alive, cancer free and I learned a lesson that day. If the phone gets to hot, stop using it. Lol
 
Upvote 0
Sepero - thanks for the bash and nano. got a problem though. got the nano working, but the Enter key does not work with ctrl-o to save the file. I have to hit ctrl-o and then Fn+Enter like on a Mac. From a linux box, I "adb shell" to my phone (LG Lucid with ICS). TERM=linux didn't work for me, so I added some to /system/etc/terminfo and set TERM=vt100. Without vt100, I could not get ctrl-o then Fn+Enter to save. Any ideas why I have to use Fn+Enter?

BTW, I just tested with Terminal IDE and it has the same issue where the ctrl-o + Enter does not work and have to use ctrl-o then Fn+Enter. Strange!

thanks
 
Upvote 0
Thanks man for this guide, really helpful. I got nano finally running properly. I changed some of your commands actually from the README file:
'chmod + x' appears not to work on android. I changed it to 'chmod 0777' (octal mode).
Copying of the Term folder requires 'copy -r' for folder copying.
I might try also to install bash, but I'm afraid I brick my phone again, which is what happened last time I tried it.

Finally, one question. Do I have to reset the mount of the system file to read-only? Now we keep it on writable, is that a problem. Or do we get problems when returning to read-only mode?
 
Upvote 0
First of all thanks for the binary & guide. I wrote a small wrapper script because I got sick of exporting the variables everytime I started a new terminal. I also packaged nano and the script into a flashable zip. Invoke it by running 'editor' as root

Usage:

Code:
root@bullhead:/ # editor

File to edit: /path/to/file
 

Attachments

  • nano-flashable.zip
    684.5 KB · Views: 324
Upvote 0
First of all thanks for the binary & guide. I wrote a small wrapper script because I got sick of exporting the variables everytime I started a new terminal. I also packaged nano and the script into a flashable zip. Invoke it by running 'editor' as root

Usage:

Code:
root@bullhead:/ # editor

File to edit: /path/to/file
Hello geofferey. Do you mind explaining flashing your nano-flashable.zip? I'm an old guy messing around with android devices. I am curios how to use your zip.
Once again pardon me for being a newbie. Thank you.
 
Upvote 0

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