Android Console FAQ


Last Updated:

  1. paimon.soror

    paimon.soror Well-Known Member This Topic's Starter

    Joined:
    Apr 29, 2010
    Messages:
    413
    Likes Received:
    76
    Just wanted to start a quick FAQ for those users who havn't had a chance to toy around with the Linux console which is what the Android OS is based off of.

    1. Commands like 'cat' 'mv' 'rm' are not working, why?

    Chances are that these commands currently dont reside on your path, which is common when you start the phone in recovery mode. To remedy this, enter the following in your console

    Note, it is important that the separator is a colon :)) not a semicolon (;)

    2. How can I copy a file from locationX/app1.apk to locationY?

    Depending on if you have busybox installed, and on your path, you may not be able to perform the 'cp' command because it doesn't exist on the system. The android system however, allows binary streaming. To copy from one location to another, perform the following action

    Note, it is important that you include the carat ">" or else the cat command will push the contents of app1 to the console. This will result in the console outputting beeping noises until the phone is disconnected from the debugger

    3. What exactly is the 'ln -s locationX/app1 locationY/app1' command doing?

    Performing an 'ln -s [source] [dest]' is creating something called a symbolic link. This is similar to Windows' "shortcut". For example, if we wanted to create a "shortcut" to /system/bin/mycoolprogram on our sdcard, we can do something like this:

    Now when we execute 'mycoolprogram' from /sdcard, it is actually referencing the applicaiton that is in /system/bin.

    4. How can I list the files in a directory?

    Just like in Unix, you can perform the 'ls' command to list out all of the files in a directory. If you would like to list out all files, including those that are hidden (hidden files in unix have a leading period, i.e., .myhiddenfolder) you can add a few flags to the ls command.

    5. What exactly am I doing when I type 'chmod #### [file]' ?

    The 'chmod' command is actually changing the permissions for the file that you supply. When you perfrom an "ls -a -l" command you will see a large list of files with detail. If you look to the far left of a listing, you will see something similar to the following:

    These are the permissions of the file. By executing the chmod you actually modify these permissions which translate to:

    So applying a 'chmod 775 thisfile.txt' would change the permissions to

    Now the owner and the users of the owning group have read, write, execute access to the file, while the rest of the world can only read and execute the file. The 'd' identifier will signify if an item is a directory. For symbolic links you will see an 'l' instead, and files will have a '-' in its place.

    6. I want to backup the files to my sdcard instead of deleting them, how can i do this?

    The first thing you want to do, is to create a folder on your sdcard where you can store these apps. I personally like to create a hidden 'appbackup' folder on my sdcard. Lets say now I want to copy and remove the 'HtcWeatherWidget.apk' file, I would do the following:

    What I did above was first, add the bin folder to my path so i can perform a "cat" and "rm" without sourcing its location. I then created a folder in on the sdcard for my apps. I then streamed out the file (a mv wont work here because the /sdcard/ and /system/ are two different mounts, and the file system will complain) to my new folder. Once the streaming is complete, i removed the old file.

    7. When trying to move a file, I am getting an error that states "mv cannot unlink '[filename]': Operation not permitted" or something similar

    The reason that this is happening is because you are trying to move a file from one partition (i.e. /system) to another partition on the same device (i.e. /sdcard). Because the two different partitions have different mounting points, a move cannot be safely performed. The alternative is to perform what is outlined in step 6

    8. Are cronjobs available on the android system?

    Crontab is available within the android console, however, when trying to modify the cron, or trying to stream the current cron to a file, the following error is thrown

    It is currently not known if the incredible nand unlock will help remedy this issue, or if the crontab is currently locked out of the rom

    [More to come as I come across some FAQs, hope this helps]
     

    Advertisement
    akvtiger, lgldrgdlr, mozetti and 2 others like this.
  2. wjdunn3

    wjdunn3 Member

    Joined:
    May 14, 2010
    Messages:
    22
    Likes Received:
    4
    Nice reference for us Linux noobs. Thanks.... and keep adding to it!
     
  3. paimon.soror

    paimon.soror Well-Known Member This Topic's Starter

    Joined:
    Apr 29, 2010
    Messages:
    413
    Likes Received:
    76
    I appreciate the gesture :) , for others who have some tips to add, please do and I will update the original post
     
  4. DirtDiver

    DirtDiver Member

    Joined:
    Apr 14, 2010
    Messages:
    23
    Likes Received:
    2
    Hey thanks for the tips. Quite a bit different than the debian or red hat nash kernals im used to dealing with.. I was worried it was stripped like a cisco IOS. Glad to see basic linux commands still apply. (Im new to android).
     
  5. DirtDiver

    DirtDiver Member

    Joined:
    Apr 14, 2010
    Messages:
    23
    Likes Received:
    2
    Just out of curiosity is there a crontab?
     
  6. paimon.soror

    paimon.soror Well-Known Member This Topic's Starter

    Joined:
    Apr 29, 2010
    Messages:
    413
    Likes Received:
    76
    the system does have a cron scheduler, but I am unsure exactly how we can modify it right now. If you try and type in 'crontab -l > /sdcard/tempcron' you get an error thrown that you need to have a special sudo permission. Maybe the nand unlock will help this, I am not sure. Sorry.
     

Share This Page

Loading...