1. Download our Official Android App: Forums for Android!

Root terminal commands....

Discussion in 'Android Devices' started by RunVert, Apr 28, 2011.

  1. RunVert

    RunVert Well-Known Member
    Thread Starter
    Rank:
    None
    Points:
    38
    Posts:
    238
    Joined:
    Jan 28, 2011

    Jan 28, 2011
    238
    12
    38
    Fort Collins, Colorado
    Anyone know of any helpful links that list and explain/summarize what different commands do on terminal?
     

    Advertisement

  2. akazabam

    akazabam Android Expert
    Rank:
    None
    Points:
    313
    Posts:
    4,418
    Joined:
    Jun 7, 2010

    Jun 7, 2010
    4,418
    1,387
    313
    Near Los Angeles
    How interested are you in using the terminal on a semi-regular basis? Your best bet is to just google unix/linux commands, as most of them will work (almost) exactly the same in Android, assuming you have busybox installed. For an even better (much more usable) experience, you'll want to use bash, as well. What ROM are you using? Some of them already have it. If not, it's easy enough to get. If you're interested in doing that, I can show you how to set it up with a bashrc file. Once you do that, you'll be all set to start using the command line in a much more usable way. From there, you'll want to learn the basic commands for getting around (ls, less, etc.) and file manipulation (cp, mv, etc.). You'll probably want to learn how to use wildcards and how to work with I/O redirection. All of this can be found in most of the basic command line tutorials, which you can easily find if you search for them. Here is one, for example. There are hundreds more out there, I'm sure. Once you learn the basics, you can feel free to PM me any time you want more information, or want to know something a little more specific. If you want to have some real fun, set up ssh, and type commands from your computer (you can do it with adb shell, too). Once you get more comfortable with it, you'll find that you can do some things way faster than you can with any app (or gui, in general).
     
    ocnbrze and RunVert like this.
  3. evomattnc

    evomattnc Android Expert
    Rank:
    None
    Points:
    213
    Posts:
    3,245
    Joined:
    Feb 10, 2011

    Feb 10, 2011
    3,245
    536
    213
    Mechanical Engineer for GE Nuclear
    NC

    Lol use ssh for some real fun...nerd :p
     
    ocnbrze likes this.
  4. akazabam

    akazabam Android Expert
    Rank:
    None
    Points:
    313
    Posts:
    4,418
    Joined:
    Jun 7, 2010

    Jun 7, 2010
    4,418
    1,387
    313
    Near Los Angeles
    Shut up (I mean that in the nicest way :p)

    I figure he wouldn't be asking if he didn't want to have fun...or am I really that much of a nerd?
     
    ocnbrze likes this.
  5. evomattnc

    evomattnc Android Expert
    Rank:
    None
    Points:
    213
    Posts:
    3,245
    Joined:
    Feb 10, 2011

    Feb 10, 2011
    3,245
    536
    213
    Mechanical Engineer for GE Nuclear
    NC

    Ooh that was a good lol...well it's the first time I've ever heard that sentence let's just say that :)
     
  6. evomattnc

    evomattnc Android Expert
    Rank:
    None
    Points:
    213
    Posts:
    3,245
    Joined:
    Feb 10, 2011

    Feb 10, 2011
    3,245
    536
    213
    Mechanical Engineer for GE Nuclear
    NC
    We are all nerds on here to some extent you are just our king...king of nerds...enjoy that...:)
     
    ocnbrze likes this.
  7. akazabam

    akazabam Android Expert
    Rank:
    None
    Points:
    313
    Posts:
    4,418
    Joined:
    Jun 7, 2010

    Jun 7, 2010
    4,418
    1,387
    313
    Near Los Angeles
    Haha, I'll take that as a compliment. Anyway, back to the topic at hand, RunVert, let me know if you want more information.
     
  8. evomattnc

    evomattnc Android Expert
    Rank:
    None
    Points:
    213
    Posts:
    3,245
    Joined:
    Feb 10, 2011

    Feb 10, 2011
    3,245
    536
    213
    Mechanical Engineer for GE Nuclear
    NC
    Can you help me figure why I can't execute any jar files on this xp pos?
     
  9. akazabam

    akazabam Android Expert
    Rank:
    None
    Points:
    313
    Posts:
    4,418
    Joined:
    Jun 7, 2010

    Jun 7, 2010
    4,418
    1,387
    313
    Near Los Angeles
    Lol, is that a serious question?
     
  10. evomattnc

    evomattnc Android Expert
    Rank:
    None
    Points:
    213
    Posts:
    3,245
    Joined:
    Feb 10, 2011

    Feb 10, 2011
    3,245
    536
    213
    Mechanical Engineer for GE Nuclear
    NC

    Lol sort of...I was trying to use the other laptop today...fail...
     
  11. akazabam

    akazabam Android Expert
    Rank:
    None
    Points:
    313
    Posts:
    4,418
    Joined:
    Jun 7, 2010

    Jun 7, 2010
    4,418
    1,387
    313
    Near Los Angeles
    Yeah, I hear ya. What were you trying to run, and how were you trying to run it?
     
  12. evomattnc

    evomattnc Android Expert
    Rank:
    None
    Points:
    213
    Posts:
    3,245
    Joined:
    Feb 10, 2011

    Feb 10, 2011
    3,245
    536
    213
    Mechanical Engineer for GE Nuclear
    NC

    It's so hard once you get a system set up to use a diff one lol. I down loaded so much stuff and all for not...I wanted to modify a .dex using smali in sdk. I can't execute any jar files though even with a command prompt. The file ass. Is correct...I dunno I just half care at this point lol
     
  13. akazabam

    akazabam Android Expert
    Rank:
    None
    Points:
    313
    Posts:
    4,418
    Joined:
    Jun 7, 2010

    Jun 7, 2010
    4,418
    1,387
    313
    Near Los Angeles
    Yeah, I know exactly what you mean. I hate working with java.
     
  14. evomattnc

    evomattnc Android Expert
    Rank:
    None
    Points:
    213
    Posts:
    3,245
    Joined:
    Feb 10, 2011

    Feb 10, 2011
    3,245
    536
    213
    Mechanical Engineer for GE Nuclear
    NC

    At least it's not just me lol. It's an old laptop but I didn't wanna bog down my gfs new one with all my dev shit so I had to try and switch but it was missing dll files I needed and all sorts of stuff. I grabbed jre6 and the latest jdk and sdk but no go..it pissed me off lol now I vented...thanks :)
     
  15. RunVert

    RunVert Well-Known Member
    Thread Starter
    Rank:
    None
    Points:
    38
    Posts:
    238
    Joined:
    Jan 28, 2011

    Jan 28, 2011
    238
    12
    38
    Fort Collins, Colorado
    haha..you guys are hilarious! :D
    anyway, umm yeah...I guess I will just google linux commands.

    I just want to know what the heck I need to type in the command field if I would like to use the app to check something. (like when you guys were helping me move my dalvic cache to /cache last week...BTW thanks again!) I am curious to know what other command prompts I dont know, that could be useful to use from time to time.
    ...Thanks!
     
  16. akazabam

    akazabam Android Expert
    Rank:
    None
    Points:
    313
    Posts:
    4,418
    Joined:
    Jun 7, 2010

    Jun 7, 2010
    4,418
    1,387
    313
    Near Los Angeles
    okay, well, here's a few of the more useful ones, I suppose:

    1) cd /path/to/some/directory

    In the terminal, you're always in a directory. Typically, when you open a shell, you start in your homedir. You don't really have one in android, so whether you're running the terminal outside of root (I think the user is app_0 or something like that) or as root, you start in / (aka root, aka the top level). The cd command (change directory) will change the current working directory from where ever you are to the path you give. In Linux/Unix, a "." is short for the current directory, and ".." means the parent directory to your current directory. "cd ." doesn't mean anything (you can't change to where you are), but you can "cd .." to change directory to the parent directory of where ever you are. Its just a nice shortcut. . and .. are used in a lot of other applications as well. Beyond that, cd can be used with a path relative to where ever you are (simply called the relative path) or a full path (start with / and make your way down, giving the whole path). For example, if you're in /sdcard, you can type "cd .." to get to /, you can type "cd /sdcard/somedir" to get to /sdcard/somedir, or you can just type "cd somedir".


    2) ls

    ls will list the files and directories in the current directory if no arguments are used or the files and directories in a path that you give. If you ls a file, it will just show the file. ls is typically used with a few different options to make it a little more usable. "ls -l", for example, will list all files and directories with information such as file permissions, the last modified date, etc. You can lookup a full list of ls options and how and why to use them.

    3) cat

    print out the contents of a text file to the screen. It can also be use to write to a file. "cat > file" will dump you at a blank line, where you can start typing. Ctrl-C will stop, and you'll have written to the file. It will overwrite whatever was in the file. "cat >> file" will do the same, but it will append to the file if it already exists.

    4) less

    read the contents of a text file, but you have the ability to scroll up and down, search for strings, etc. You can lookup how to use it.

    5) df

    df stands for disk free, and it will show available space on mounted filesystems. df -h is used commonly, as it will show human readable sizes (2K instead of 2048, for example). Again, you can lookup more options.

    6) du

    du will show disk usage for a particular directory/file. Simply type "du file" is not all that useful, but you can do something like du somedir/* to see how much space each file/dir is using in a directory. Note that * is a wildcard meaning "everything", basically. It can be used with part of a string, so you could say something like du somedir/partofname* to run du on files that have partofname in the name of the file. In any case, it also supports the -h option for human readable format. This is commonly used for something like this:

    du -sh *
    du -sh somedir

    The first one will show the total disk usage for each file/directory in your current directory. If you have two directories names dir1 and dir2, it will print out the total space used by dir1 then the same for the next. It's total usage for each, basically. The second one is the same, but is used to show the total for just directory you want.

    7) mount

    By itself, it will print out a map of mounted devices, where they are mounted, and the mount options. It can also be used to mount currently unmounted devices, remount currently mounted devices with other options, etc. You can use the umount command to simply unmount a mounted device. When I say device, I mean any block device that can be mounted. A simple disk partition is an example.

    8) ps

    See a list of all running processes. The busybox implementation is a bit weird. Normally you'd type "ps -ef" to get a list of processes with the PID (process ID), it's parent PID (what launched the process), the name of the process, how long it's been running, etc. This doesn't seem to do anything on android. Just running ps by itself seems sufficient on Android. In any case, this is most commonly used with...

    9) grep

    grep is a command line search utility. It normally works like this:

    grep pattern file

    That means that you want to search for a pattern in a given file. If you do that, it will print out all lines from the file that match the pattern. You're going to want to lookup how to use various kinds of IO redirection, as grep is most commonly used with the "|" aka "pipe". What this is used for is to take the output of one command and use it as input for some other command, so when used with ps, it would look like this:

    ps|grep someprocess

    Where some process is a process or another. If I do this, and it returns the process with its pid, etc. it means I know it's running. If it returns with nothing, it's not running. This, of course, only works if I know the name of the process. It is also helpful if you want to know the pid of a process.

    10) cp/mv

    These are two completely different commands, but you'll use them both in similar situations. Cp is copy, and it is used like this:

    cp source destination

    Both source and/or destination can be a full path or relative path. Source must be a file, but if you want to copy a whole directory, you can, but you must use the cp option to do that (I'd tell you, but it escapes me at the moment). Destination can be a file name (in which case, the file being moved is renamed to the destination file name you gave) or you can give a path as the destination, in which case the source file is copied there with its current name. Here is where the command line becomes very handy, though, more so than any gui. The command line allows so many different ways of combining commands and referring to multiple files, etc. all at once. You can say something like this, for example:

    cp /sdcard/somdedir/* /sdcard/somedir2/

    That will copy all files in somedir to somdedir2. You will have to give it the option to be recursive, though, if there are directories in somedir. In any case, this is not something that is particularly easy to do without the command line. As you can see, it's just a one line command, here.

    mv is similar, except it will move files. It's used in the same way:

    mv source destination

    It has the same basic rules too (use relative or full paths). If not source file is given (just a directory) the whole directory will be moved. If the destination directory exists, it will copy the file/directory there. If it doesn't, it will move the directory to the destination, but rename it to whatever name you gave. The directory you're moving to must exist, though. By that, I mean, you can move a directory to a full path tree that doesn't exist. At least the top level must exist. Note that mv is also a rename utility of sorts. When you say mv file1 file2, it will basically move the file to the current location using the new name file2. This is the same as basically just renaming the file from file1 to file2. Once you get more comfortable with the command line, there are some shortcuts that I won't go into now, but just know that you'll be able to save a lot of time.


    There are many, many, many more commands you'll want to know, but that's a starter. For Android specifically, those are some of the more common ones you might want to use.
     
    virus786, ocnbrze, geewhiz and 3 others like this.
  17. ardchoille

    ardchoille Android Expert
    Rank:
    None
    Points:
    333
    Posts:
    3,684
    Joined:
    Mar 8, 2011

    Mar 8, 2011
    3,684
    1,940
    333
    Male
    Ordained Minister
    Seattle
    ocnbrze, evomattnc and akazabam like this.
  18. akazabam

    akazabam Android Expert
    Rank:
    None
    Points:
    313
    Posts:
    4,418
    Joined:
    Jun 7, 2010

    Jun 7, 2010
    4,418
    1,387
    313
    Near Los Angeles
    Thanks. Definitely some good stuff in there. I have my own cheatsheet for some more complicated commands. I see in your list that some stuff is appropriate for more specific applications. All that apt stuff, for example, is a debian package thing, and isn't applicable for Android, or even most other Linux distributions. Still good to know, though :).

    I see also, that you briefly mentioned brace expansion. There are so many different things you can do in bash (which is specifically what we've been talking about with things like this) that make the command line so much more useful. There are various kinds of expansion, but I do happen to like brace expansion. One thing I mentioned above were some shortcuts for using mv and cp. Specifically, they can be used with brace expansion.

    Brace expansion is something like this:

    a{b,c}

    From the command line, that will expand to:

    ab ac

    This means that anything inside the curly brackets is added to whatever is outside of them for each string in the comma separated list. In some versions of bash, you can also give a list like this:

    1{2..5}

    That would expand to:

    12 13 14 15

    If you use this without anything outside the brackets, it just expands to what's inside:

    {a,b} is a b, which is not all that useful, but {1..6} would be 1 2 3 4 5 6, and that is useful.

    Anyway, back to the point at hand, a useful application for this is with mv, for example. You can say something like this:

    mv somelongassfilename{,.bak}

    When you don't have anything on either side of the comma inside the brackets, it appends...well...nothing to the part outside, so it would expand to this:

    mv somelongassfilename somelongassfilename.bak

    If you remember, that basically will just rename the file. The point is that you save yourself the trouble of retyping long names when you want to rename it, but just add a small change to the name. The same concept can be used with cp.



    I can really go on for hours with all of this, so I won't go into too much detail, but if you want, I can give some more details on how to make the terminal emulator a little easier to use in Android with a bashrc file and some quick changes to the setting. You can really save yourself some time if you plan to use this more often.
     
    ardchoille and 9to5cynic like this.
  19. akazabam

    akazabam Android Expert
    Rank:
    None
    Points:
    313
    Posts:
    4,418
    Joined:
    Jun 7, 2010

    Jun 7, 2010
    4,418
    1,387
    313
    Near Los Angeles
    Just because I'm bored, I'll go ahead and show you how I use the terminal emulator, and how it can save you time, and make things easier. For starters, some of the stuff we've talked about is specific to bash. By default, Android uses the bourne shell, aka sh. It's sort of the precursor to bash. Bash is basically the "improved" version of sh (it stands for Bourne Again Shell, haha). Bash has many advantages of sh, such as command history, tab completion, and the aforementioned brace expansion (along with other types) just to name a small few. Not all Android ROMs have bash. If you're on stock, you won't have it. If you have a custom ROM, and it comes with a2sd (even if you're not using a2sd) you probably have bash. If you don't, it's easy enough to get. Beyond that, since this is Android, and not a typical Linux distribution, most of the commands you're going to use are actually busybox. Busybox is a multipurpose binary that knows which command you want to run based on the name you called. Basically, it's all the same binary, but there are symlinks to that same binary, which knows what you want based on the name you called.

    So, when you first run the terminal emulator, you're going to be using sh. To see if you have bash, run:

    which bash

    If that returns with the path to bas (probably /system/bin/bash) then you have it. If it just says not found, then you don't have it. To get it, you can flash a2sd if you're on a custom ROM, and it doesn't already have it (as long as the ROM supports it) or just flash bash by itself. You can look through threads I've started for something called "unandroid". It's a script I wrote for extracting nandroid img files. Just flash that, as it includes bash.

    Once you have bash, it will be in /system/bin/bash. Shells have a concepts called environment variables. These are basically your typical variable, except they affect and/or have information about the environment you're in. There is a particular one called $PATH. This variable is a colon ":" separated list of paths. When you try to run a command, the shell will look in each of the paths defined in $PATH for the executable that you tried to run. If it finds it in one them, it runs the first one it comes across (If you have two of the same binaries in different paths, it run the first one it finds, running through $PATH in order). If it doesn't find it in any of the paths in $PATH, it returns that it can't find the command. If you're trying to run an executable that is not in a path in $PATH, you have to give the full or relative path. Remember the "." path from earlier? It basically means the path you're currently in. This is one such time where it can be useful. If you're in the directory where you have an executable that you want to run, and it's path is not in $PATH, you can run it by giving the relative path, where the relative path is the current path. It looks like this:

    ./executable

    Anyway, that was a total rabbit trail. The point is that once you have bash, you can start using that as your shell instead of sh by running:

    bash

    You don't have to give the path since /system/bin is in $PATH. So, now that you have bash running, you can start taking advantage of it. The first thing to do is to use a .bashrc file. A bashrc file (or .bashrc, where the "." before the name means its hidden) is a file that is run when bash first starts. Each user (or just the default or root since this is just android) can have their own bashrc file. Normally, you keep this file in your homedir. The problem is that the homedir can be defined by an environment variable or by other user management not available in Android. The point is that you can set up your homedir in your .bashrc, but since you don't have a homedir before you load that, bash won't know where your bashrc file is when executed. So, you need to tell it where to look.

    So, before you run bash for the first time, you'd need to run it with a command line option to tell it where to look. I'll start by using my own bashrc file as an example. I've uploaded it here:

    .bashrc

    What you'll want to do is download this file, and copy it to /sdcard. Once you do that, you can run bash like this:

    bash --rcfile /sdcard/.bashrc

    What that will do is run bash, but once it runs, it will execute that file. The contents of a .bashrc file can be any command or bash scripting command that can normally be executed from the bash command line. The purpose is to set up your environment in whatever way you see fit. I'll go ahead and go through mine line by line so you can understand what it's doing. This is getting long, so I'll do it in another post.
     
    Xtremedays and 9to5cynic like this.
  20. 9to5cynic

    9to5cynic Android Expert
    Rank:
    None
    Points:
    633
    Posts:
    4,873
    Joined:
    Feb 20, 2011

    Feb 20, 2011
    4,873
    1,766
    633
    /home/
    This is awesome! I will definitely be using this from now on. Renaming files just got a whole lot easier! ((which is a strange thing to be excited about on a friday night...*sadface*))
     
  21. akazabam

    akazabam Android Expert
    Rank:
    None
    Points:
    313
    Posts:
    4,418
    Joined:
    Jun 7, 2010

    Jun 7, 2010
    4,418
    1,387
    313
    Near Los Angeles
    Okay, here is a walkthrough of what my .bashrc file does, and how its used:

    These are two specific environment variables. There is a command in bash called "history". When you run that, it gives you a list of previously executed commands, along with the number, which counts up. The HISTFILE is the file where these commands are stored, and HISTFILESIZE is the number of lines that can be stored here before it starts to overwrite. There is another variable you can set called HISTSIZE, which is the number of lines stored in a particular terminal session, which are then copied to the file when you exit. I live with the default in Android. What's cool about this is that you can type "history", find the command you ran previously, then rerun it without typing out the whole comand again. For example, if you run history, and see something like this at the bottom:

    454 ls /some/really/really/really/really/really/really/long/path

    that means that the 454th command in the history file was ls yada yada. It's a long command, so to save yourself the hassle of typing it out again, you could just run this:

    !454

    That will run the 454th command in the history file, which is what you were looking for.

    Okay, these are just normal variables. When defined from the shell (rather than a shell script) the shell has access to read them. The purpose is to save yourself a little time. That first one will set a variable called $serialno, which will store the serial number of your phone. The way I've done it, it can be run on any phone, and it will get that phone's sn. It's better than if I'd hardcoded it. It's using something called command substitution. It's where you run a command inside of $() or `` and the output of that command is the text used to populate the variable. It can be used in other applications beside just setting variables. In any case, then you run:

    getprop ro.serialno

    from the terminal, it returns your sn. When you run it like this:

    $(getprop ro.serialno)

    it would basically try to run your sn from the command line. That's not a command, it's just a string, but it can be assigned to a variable as I've done above.

    Anyway, the rest of those variables are basically just paths. Let's take $dta, for example. We say that $dt=/data. That means that, through variable expansion, when I type:

    cd $dt

    from the command line, since I've set this up, it expands to this:

    cd /data

    and changes directories to /data. Now, $dta is defined as $dt/app, which again expands to /data/app, so I can type:

    cd $dta

    which will expand to:

    cd /data/app

    As you can see, this save a lot of time when you want to refer to a directory with a long name, but don't want to type the whole thing out. As you can see, I have $nan defined for my path to nandroid backups. I use RA, so it has that long path that includes your sn. That's a pita to type from the command line, so I can just type:

    cd $nan

    and it takes me right there.

    Okay, the purpose of this section is to set up the $PS1 environment variable. This variable defines what your prompt looks like. You know the whole thing where you open the terminal, and you see "$", but when you type "su" it changes to "#"? That's your prompt. Normal users see $, while the superuser gets the super special #. You can change this prompt, though to give you more information and make things a little more readable. In a normal Linux environment, you'd probably want the username, hostname, and current path, here. This is Android, so at least the current path is useful. I won't go into exact details of how this is set up above, but I'll tell you exactly what it does. It makes the prompt look like this:

    [/current/path]$

    or

    [/current/path]#

    Where $ is still a normal user and # is still root. The special thing about this is that $ is highlighted green, which # is highlighted yellow. So, you *immediately* know whether you're root or not. It's a good way to make sure you know for a fact that you're root or not with a very quick glance. It also have the benefit of helping you keep track of where your prompt is. Sometimes, it can be hard to look through your history and see where your prompt commands are and where the output of command is. This helps you see which is which.

    Okay, aliases are where you *really* save yourself some time. A lot of times you have commands that you like to type a lot, but they're cumbersome to type out a lot, especially if you're using a soft keyboard, like we do on the Evo. An alias is basically a way of saying, when I run this alias, run this command in its place. So, I just have to run:

    sw

    and bash will automatically run the long command to remount /system as rw. When I'm done, I just run:

    sr

    and bash will run the long command to undo it. Time saver? yep :). It can also be used with commands that take arguments. As you can see, I have df as an alias to df -h. That means ever time I run df, it actually runs df -h. df can take arguments, so if I run df /system, it will actually be running df -h /system. You can read the rest to figure out what each one does.

    These are shell functions. Like aliases, when run from the command line, they perform the function. Unlike an alias, they can do much more complicated tasks. Aliases are usually just one liners. Functions can be more complicated. The ls ones don't need to be functions. They were more complicated before I simplified them, and never switched to aliases for them. I'll change that later. The history one is nice, though. Basically, when you run "hs" it will actually run "history", as described earlier. But, if you run "hs command" it will run history|grep command, where command is some command you ran that you want to search for. It makes the history command very useful, by allowing you to search through commands you've previously run. That, in combination with !number, makes rerunning commands very easy.

    The shopt commands just change how the shell behaves. You can run shopt by itself to see what some of these settings are. With -s and a setting, it enables that setting. cdable_vars means that I can cd to those path variables I have defined above without giving the "$". So, remember how I said I could cd to my nandroid backup directory by just running cd $nan? With this option set, I can run "cd nan" and it knows nan is a variable, but only if nan isn't actually a directory where I'm at. cdspell will basically pickup typos in paths when you cd to a path. If it's off by a letter or two, it figures that out, and cd's you to where you meant to go. dotglob has to do with tab completion, which I'll go into later. And last but not least, when cd is given with no arguments, it changes directory to your home directory. As you can see from when I was setting PS1, I set $HOME for default or root users. This part here will automatically drop you in / if you're root or /sdcard if you're not.

    I'll go into some more stuff later, especially on how to automatically run this from the terminal on start, and how to use some ctrl shortcuts.
     
    Xtremedays and 9to5cynic like this.
  22. akazabam

    akazabam Android Expert
    Rank:
    None
    Points:
    313
    Posts:
    4,418
    Joined:
    Jun 7, 2010

    Jun 7, 2010
    4,418
    1,387
    313
    Near Los Angeles
    I get excited about stupid, nerdy things all the time. Glad somebody feels the same enthusiasm ;).
     
    ocnbrze likes this.
  23. beastinbolts

    beastinbolts Android Expert
    Rank:
    None
    Points:
    78
    Posts:
    823
    Joined:
    Apr 16, 2011

    Apr 16, 2011
    823
    92
    78

    Aka did u just type all the or did u copy an paste it...wow u can type man. Lol
     
  24. akazabam

    akazabam Android Expert
    Rank:
    None
    Points:
    313
    Posts:
    4,418
    Joined:
    Jun 7, 2010

    Jun 7, 2010
    4,418
    1,387
    313
    Near Los Angeles
    Okay, here is how I specifically use this with the Android terminal emulator. Open the terminal emulator, then go to menu->preferences. For "Status Bar" I have the option selected to always show the status bar. That's just my preference; do whatever you want. For colors, I use green text on black. That's the "standard" more or less, and it's a lot easier to read that white on blue. For control key, I use volume down. Pick whatever you want, but make sure it's something that's easy to press. Then here is the important one - for "Command line", remove whatever is there, and type this, exactly:

    /system/bin/bash --rcfile /sdcard/.bashrc

    That assumes you have bash in /system/bin, and that you copied my .bashrc to /sdcard (or made your own and put it there). Now, when you open the terminal, you'll have bash running without you having to run it, and it will run the .bashrc, first, automatically.

    One of the very common things you'll use is the ctrl key. We don't have one on the soft keyboard, and even if we didn't it'd be a pita to use. So, now, you can hold volume down, and press whatever you want on the soft keyboard to run ctrl-whatever. So, first of all go to menu->special keys. That will show you what you can do with volume down to simulate various keyboard options you'd normally have. One you'll use a lot is vol-dn + 8, which will simulate the up arrow. This will cycle through previous commands you've run. It's kind of like the whole "history" command thing, but even easier. Beyond that, you can use vol-dn + any other key to simulate ctrl + that key. So, ctrl-c, for example, will stop whatever is currently running. So, as an example, run "top". That will give you a constantly updated list of running processes. It doesn't drop you back at a prompt, though, as it keeps running. To get back to the prompt, stop it by holding volume down, and pressing "c" on your keyboard. You can search google for various control key combinations for some more ideas on how to use this.
     
    Xtremedays and 9to5cynic like this.
  25. akazabam

    akazabam Android Expert
    Rank:
    None
    Points:
    313
    Posts:
    4,418
    Joined:
    Jun 7, 2010

    Jun 7, 2010
    4,418
    1,387
    313
    Near Los Angeles
    I never copy/paste ;).
     
    ocnbrze likes this.
Tags:

Share This Page

Loading...