1. Download the #1 Android News App:   EarlyBird - News for Android
    Dismiss Notice

[GUIDE] Installing Bash and Nano on Android

Last Updated:

  1. Sepero

    Sepero Linux Guru

    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:
    bash v3.2.0
    nano v2.0.9

    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.

    Attached Files:

    otrcomm, EarlyMon and TheAmazingDave like this.
  2. theisonews

    theisonews Well-Known Member

    What is it used for?
  3. you can check and change files with bash.i dont know what he wants to use it for. its for pcs i thought.

    KA24DERACER Well-Known Member

    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.
    Sepero likes this.
  5. 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.
  6. Sepero

    Sepero Linux Guru

    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.
    notty likes this.
  7. ninjasinabag

    ninjasinabag Well-Known Member

    To all the naysayers of these guide, I say thee nay.
    Good job, Sepiro. Another well thought out guide with potential.
    adanmex likes this.
  8. Sepero

    Sepero Linux Guru

    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.
    aboatright likes this.
  9. ninjasinabag

    ninjasinabag Well-Known Member

    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.
    aboatright likes this.
  10. 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.
  11. Sepero

    Sepero Linux Guru

    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.
    ninjasinabag likes this.
  12. 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.
  13. ninjasinabag

    ninjasinabag Well-Known Member

    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...
  14. 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.
  15. ninjasinabag

    ninjasinabag Well-Known Member

    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
  16. otrcomm

    otrcomm New Member

    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!

  17. Sepero

    Sepero Linux Guru

    In my terminal's initial command, I have it run this:
    export TERMINFO="/mnt/sdcard/root/bashnano/terminfo";export TERM="linux";

    The location "/mnt/sdcard/root/bashnano/terminfo" is where I have the files unzipped. Hopefully that helps.
  18. sjorsvanheuveln

    sjorsvanheuveln New Member

    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?

Share This Page