Terminal commands - G1 Android Development

Is there a list somewhere for the commands because i tired to do the "dir" to get a list of files in the folder but it work. (on terminal or adb shell).
* Also what is the best file manager? Is there anything that has a password so that other people cant get into it?

'ls' is the unix command to list contents in a folder

Ok thanks. just been a long time since i messed with Linux shells i guess i should get my books out and start reading again

Android's Linux commands
although he got the wrong command for list files, he raises a good point, the android linux is far from having all commands other linux system have - does anyone have these documented somewhere? what it has and what it doesn't have?

eladkatz said:
although he got the wrong command for list files, he raises a good point, the android linux is far from having all commands other linux system have - does anyone have these documented somewhere? what it has and what it doesn't have?
Click to expand...
Click to collapse
if you are running jf 1.31 then you have busybox installed.. google busybox and you will find out all the terminal commands you can run from your phone terminal or over adb shell.....

eladkatz said:
although he got the wrong command for list files, he raises a good point, the android linux is far from having all commands other linux system have - does anyone have these documented somewhere? what it has and what it doesn't have?
Click to expand...
Click to collapse
ls /system/bin
ls /system/xbin
ls /system/xbin/bb
that should give you a fairly complete listing of the commands available.

korndub said:
if you are running jf 1.31 then you have busybox installed.. google busybox and you will find out all the terminal commands you can run from your phone terminal or over adb shell.....
Click to expand...
Click to collapse
I just noticed this myself. I need to remove a symbolic link and recreate it by "unlink" and "rm" dont' seem to work. Is there a busybox command that will do it?

A quick google search brought up this annotated list for those new to these commands:
http://www.busybox.net/downloads/BusyBox.html
JF Thanks for that, I was looking for that folder earlier and could not find it for the life of me. Blame it on drowsiness ...or just plain not wanting to be at work.

That list is only valid for modified Android. Stock Android runs toolbox, which has a much neutered list. Aside from JF's method, you can also look at the tpolbox links in update-script of an official update.zip

Hmmm.. does this mean overclocking is possible? Not that we "REALLY" need it right now but.....
adjtimex [-q] [-o offset] [-f frequency] [-p timeconstant] [-t tick] Read and optionally set system timebase parameters. See adjtimex(2).
Options:
-q Quiet
-o offset Time offset, microseconds
-f frequency Frequency adjust, integer kernel units (65536 is 1ppm)
(positive values make clock run faster)
-t tick Microseconds per tick, usually 10000
-p timeconstant

If you read any manpages on the command you would see that it's for correcting system clock drift.

If you type in "busybox" (without quotes) it will give you the list of commands. Enter "<enter command here> -d" for a description of the command you entered. Hope this helps...

"busybox --help" anybody? i thought the bb we had on our androids was not supposed to be the full busybox?

File manager
The Best file manager i found
https://play.google.com/store/apps/...lt#?t=W251bGwsMSwxLDEsImNvbS5yaG1zb2Z0LmZtIl0.
ha root explorer as well...
ca use app lock to protect it!

Related

Ash as login shell

Hi All,
The Ash shell provides a few advantages over the Android default sh shell such as command history and cursor handling at the prompt. There are other benefits, but these are the first that come in most handy (to me).
The following tutorial will get you ash as the login shell with as yet no ill effects:
Note: that in my case, I'm using my android2sd construct and thus this modification is being done to my active overlay profile setup, thus to undo it I can simply boot into "safe\\normal" mode and undo the changes without possibly locking me out of the console should it have failed (which it didn't) But you can edit the Android /system/bin/sh file in this manner directly.
Ash as Login Shell:
OK, make the /system fs read-write:
mount -o remount,rw /system
Click to expand...
Click to collapse
Note: that the fs type is not needed, and in my case is not yaffs but ext3, Android will figure it out proper.
Next,
cp -a /system/bin/sh /system/bin/sh0
Click to expand...
Click to collapse
(this is for backup purposes and allows us to undo the change if so desired, or delete it if no longer needed).
Note: I'm using JF1.51 roms, so busybox ash is available as /system/xbin/bb/ash, so that is what I am using here; use ash however you are able to access it.
echo "#!/system/xbin/bb/ash">/system/bin/sh
echo "/system/xbin/bb/ash \[email protected]">>/system/bin/sh
Click to expand...
Click to collapse
Please note the use of (redirect\\overwrite)> and (redirect\\append)>>.
This will overwrite sh with a script to load the desired shell, executing any command-line arguments passed, and preserve the permissions of the original sh file. You can manually set the permissions the same as they are for our sh0 backup if the permissions (root.shell)(0755) don't seem to keep.
Finally reset the read-only state of /system:
mount -o remount,ro /system
Click to expand...
Click to collapse
Now if you shell-in\\telnet-in you should get the ash prompt which unlike the Android sh default prompt, includes the present working directory(pwd) ie: '/#' instead of just '#'.
Note: A reboot should not cause the loss of the modification, but if does, copy the new sh script to your /data/local/bin location or something and copy it back via boot script or something.
Shell Scripts:
If you're like me, you discovered that Android didn't need the interpreter declaration comment in scripts, and thus may not have used them...Well, you will need to update your scripts to include them by adding something similar to the following as the first line of your scripts:
#!/system/xbin/bb/ash
Click to expand...
Click to collapse
Again, please note that I am using JF1.51 roms and the location of the busybox ash shell is what I'm listing; put the full location to the shell you intend to use as this location.
Without the interpreter declaration, ash simply complains 'not found' at the first command, as ash doesn't know how to interpret the script, and doesn't seem to default to the login shell.
Hope someone finds this helpful!
sweet. This is going to be very useful
BAM. thats sexy. i just did this on CM3.6.7.1. works like a charm.
scratches head. i'm lost. what does this do and how does this make my g1 better?
temporizer said:
scratches head. i'm lost. what does this do and how does this make my g1 better?
Click to expand...
Click to collapse
im not sure about the other features, but the one i installed it for is to have your working directory in front of ur prompt. ex:
Code:
/# cd /sdcard
/sdcard # cd /system/sd
/system/sd #
etc...
EDIT: Also, if you use ConnectBot, you'll notice with the regular sh, if u scroll up with tracball, you get BS characters on the prompt. with THIS one, when you scroll up, you get last command entered. VERY handy for when you mistype one character on a long-ass command.
I love you
Couldn't you do this?
Code:
mv /system/bin/sh /system/bin/sh0
ln -s /system/xbin/bb/ash /system/bin/sh
great job, i'm going to get ash working on my G1 (CM-3.6.7.1)
Thanks.
kanstin said:
Couldn't you do this?
Code:
mv /system/bin/sh /system/bin/sh0
ln -s /system/xbin/bb/ash /system/bin/sh
Click to expand...
Click to collapse
I tried this and it worked even after a reboot...
Sweet, I love the scroll back with trackball in the terminal!!! Me thinks this should get absorbed into the next Cyan release.
kanstin said:
Couldn't you do this?
Code:
mv /system/bin/sh /system/bin/sh0
ln -s /system/xbin/bb/ash /system/bin/sh
Click to expand...
Click to collapse
Yes, I reckon you could. Though I had done a few experiments where the symlink failed, but I'm fairly sure it was do to the link: /system/xbin/bb/ash -->../busybox and /system/bin/../busybox not existing...so I did it via script. Many ways to skin a cat they say.
Thank you all... this is fricken awesome!!
temporizer said:
scratches head. i'm lost. what does this do and how does this make my g1 better?
Click to expand...
Click to collapse
It gives a more advanced shell for when you use the command line interface or telnet into your G1. If you don't use the command line a lot, it won't help you.
As for specific benefits to the advanced version, it was listed in the first post.
Hi,
imho this is rather a hack that exposes you to the risk at least on CM to loose your
shell during boot as xbin.sqf the compressed squashfs filesystem containing
busybox is mounted rather late in the boot process. A cleaner solution would be to
move busybox to system/bin and link it to sh. That way you ensure that sh will
always be accessible during boot and also later on, thus not interfering with
further developments. A alternative could be to compile a standalone version
of busybox containing only ash (for size reasons, as size in /system/bin is precious)
copy that to /system/bin and link sh to it.
Seems to work fine on Dude's. Not really sure how it should open, but I type "ash" at the prompt and I get the /$ and /# if superuser. I also get the command history by rolling the trackball, which is a very nice feature.
Can i install this without using my PC?
temporizer said:
Can i install this without using my PC?
Click to expand...
Click to collapse
Should work using terminal.
Tried it on JACHero 2.7.1
I tried the hard link one and I get a read only fs error on the first move command. What should I chmod to get past that?
mugafuga said:
I tried the hard link one and I get a read only fs error on the first move command. What should I chmod to get past that?
Click to expand...
Click to collapse
Do this first before the mv and the symlink.
mount -o remount,rw /system
farmatito said:
Hi,
imho this is rather a hack that exposes you to the risk at least on CM to loose your
shell during boot as xbin.sqf the compressed squashfs filesystem containing
busybox is mounted rather late in the boot process. A cleaner solution would be to
move busybox to system/bin and link it to sh. That way you ensure that sh will
always be accessible during boot and also later on, thus not interfering with
further developments. A alternative could be to compile a standalone version
of busybox containing only ash (for size reasons, as size in /system/bin is precious)
copy that to /system/bin and link sh to it.
Click to expand...
Click to collapse
Is this in any way accurate? I dedicate my g1 to cyan's roms and wouldn't want anything to hinder any of the goodness that is cyanogenMod. Advice?
Load ash when terminal is started?
temporizer said:
Is this in any way accurate? I dedicate my g1 to cyan's roms and wouldn't want anything to hinder any of the goodness that is cyanogenMod. Advice?
Click to expand...
Click to collapse
Safest method will be to change to ash shell once terminal app is started (same as typing "ash" to switch shell from sh to ash). I don't know how to do it in android (in linux you could add it to your login script).
So if someone knows how to execute a command when we login using the terminal app, then switching to ash shell would work without fear of breaking any other functionality.

[HOW-TO]Set up Android SDK/ADB/Fastboot on Ubuntu Linux

When I first attempted to install the SDK, I found tutorials that only had bits and pieces about the whole procedure. A lot of Google searches and hours of eye strain. I wanted to write a solid tutorial, but instead of publishing it in a personal blog, I chose to publish it here on xda-developers. This is the definite forum to come to if you are interested in Android/G1/HTC Dream development or costumization. I wrote this to make the enlarge the knowledge of this community.
!! THIS TUTORIAL IS FOR THE LATEST UBUNTU RELEASE: JAUNTY JACKALOPE 9.04 !!
!!START -------------------------------------- Optional Preparation --------------------------------------
This applies if you -
Are interested in installing Ubuntu for the first time.
Are/will be reinstalling Ubuntu from scratch.
Want to keep your SDK installation easy to reach.
Want to keep things nice and clean.
And your machine -
Has a second hard drive.
Has free space for another small partition.
This procedure will make things easier during installation of the SDK and in the long run. Hopefully you've read about partitions. If you are dualbooting, please read this first to get an idea of what you're doing.
While installing Ubuntu and on the Prepare Disk Space screen (partition editor), select "Specify partitions manually (Advanced)"
On the Create Partition dialog, select the following options:
Type for the new partition: Primaryor Logical if you're dualbooting and know what you are doing.​
New partition size in megabytes: 5120MB (5GB) might work. BUT:
ccyrowski said:
It should be noted that if you ever plan on compiling kernels and/or cupcake ROM's you will NEED ubuntu8.04. You'll also need at least 10GB.
Click to expand...
Click to collapse
Location for the new partition: Beginning
Use as: Ext4 or Ext3Filesystem doesn't matter. (?)​
Mount point: /AndroidSDKEnter this manually​
Complete Ubuntu installation as usual.
-------------------------------------- Optional Preparation -------------------------------------- END!!​
You will now install the SDK.​
!!START -------------------------------------- Installing Android SDK --------------------------------------
Installing the SDK is the easiest of all.
Download the SDK.169.9 MB [http://developer.android.com/sdk/download.html?v=android-sdk-linux_x86-1.5_r3.zip]​
Right-click and select Extract Here.
Move the contents of the android-sdk-linux_x86-1.5_r3 directory to your desired location.If you followed Optional Installation, move the contents to your /AndroidSDK directory in the root of your filesystem.​
Close directory window.
-------------------------------------- Installing Android SDK -------------------------------------- END!!​
You will now set up your bashrc file and UDEV to recognize your HTC Device.​
!!START -------------------------------------- ADB + FASTBOOT --------------------------------------
The Android Debug Bridge (adb) is one of the tools that will help you the most when you run into flashing problems or running shell commands directly from your machine. UDEV will not recognize your G1 out of the box, but we will configure it with some rules so it can connect.
We will work with /AndroidSDK as the location of your sdk. If this is not your setup, I think you're smart enough to figure it out.
Editing .bashrc file to use tools from /AndroidSDK/tools/ directory -
Go to your home folder.Example: /home/wddglr/​
Press Control + H to view hidden files.
Look for your .bashrc file and double click to open it with gedit.
Add the following lines to the top of the file:
Code:
#AndroidDev PATH
export PATH=${PATH}:/AndroidSDK/tools
IMPORTANT NOTE
savethechicken said:
This is the way that I have my .bashrc file setup. For those having problems with it not recognizing the adb as a command try this...
Code:
export PATH=$PATH:/AndroidSDK/tools
I removed the {} around ${PATH} and it is working if I had them on it would say that it didn't recognize the command. Removed them and all works well.
Click to expand...
Click to collapse
Setting up UDEV to recognize HTC Device -
Type the following into a terminal (Applications > Accessories > Terminal):
Code:
gksudo gedit /etc/udev/rules.d/51-android.rules
Now add the following line to the blank file:
Code:
SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"
Click save and close.
To restart udev, open up a terminal and enter:
Code:
sudo /etc/init.d/udev restart
Setting up fastboot -
Download this fastboot binary from http://android-dls.com.130.4 KB [http://android-dls.com/files/linux/fastboot]​
Once downloaded to your desktop, right click and select Properties.
Navigate to the Permissions tab and configure the following option:Execute: [√] Allow executing file as program​
Click Close.
Move the fastboot bianary to your /AndroidSDK/tools/ directory.
Reboot.
-------------------------------------- ADB + FASTBOOT -------------------------------------- END!!​Now you can use adb and fastboot directly from any terminal. If you chose to do the Optional Preparation, you can now save your Eclipse Workspace and your downloaded/custom ROMs/Themes in this new /AndroidSDK directory keeping things easier to reach and safe from evil disk errors or other mishaps!!! :O​If you are having problems, send me a PM. I will be happy to help.
*applaudes* awesome. Should be added to helpful threads.
very nice! perhaps add a "(How-To)" prefix to thread??
Everything was going great in setting this up until I got to this part "gedit /etc/udev/rules.d/51-android.rules"
I cannot find "51-android.rules" inside of "rules.d"
Any thoughts>?
nicholasbithell said:
Everything was going great in setting this up until I got to this part "gedit /etc/udev/rules.d/51-android.rules"
I cannot find "51-android.rules" inside of "rules.d"
Any thoughts>?
Click to expand...
Click to collapse
it does not exist, you will make it.
do the command as stated above.
Code:
gksu gedit /etc/udev/rules.d/51-android.rules
Damn you beat me to it!
I was just thinking earlier about doing this same "How-To" guide, I was surprise to see it posted just now.
Anyways, great job!
Can someone sticky this thread. Now I have ADB & fastboot on my Win7, Ubuntu, and OS X Partition. Thank you wddglr.
bravo...linux rocks even better now!...
Awesome tutorial for setting this up. Have been using adb/sdk on ubuntu since oct. but this would have saved me some headaches back in the first couple of weeks.
The onlything that is not clear and/or confuses me is
Setting up the udev to recognize the device.
SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"
Have never used this (will now to see if it will do anything) and the only problem i have is that sometimes i have to kill-server to get it to connect correctly but i have seen this happen to almost everyone on many forums since the 9.04 came out. And even after putting this file on the computer i have had the problem.
savethechicken said:
Awesome tutorial for setting this up. Have been using adb/sdk on ubuntu since oct. but this would have saved me some headaches back in the first couple of weeks.
The onlything that is not clear and/or confuses me is
Setting up the udev to recognize the device.
SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"
Have never used this (will now to see if it will do anything) and the only problem i have is that sometimes i have to kill-server to get it to connect correctly but i have seen this happen to almost everyone on many forums since the 9.04 came out. And even after putting this file on the computer i have had the problem.
Click to expand...
Click to collapse
It happens to me also from time to time. especially when i reboot and want to go into adb while the device is rebooting. although that file, 51-adndroid.rules, is what helped me get adb to recognize the device. the guide on developer.android.com talked about 50-android.rules but after a few deep searches i found this: http://groups.google.com/group/android-developers/browse_thread/thread/1d3488c601243686
Okay A few questions for you....
First I fixed the whole "couldnt find the (51-android.rules) file now I am having issues with executing ADB!
When in terminal this is what I get...
"[email protected]:/home/nick# /AndroidSDK/tools/adb
bash: /AndroidSDK/tools/adb: cannot execute binary file
[email protected]:/home/nick#"
and I also noticed something different from when I start terminal the first lines now state
"bash: : command not found
[email protected]:~$"
I dont remember the first line ever being there, but I could be mistaken!
Any help would be greatly appreciated!
Edit: You state creating "Mount point: /AndroidSDK" During Installation, and what I did was Just place my AndroidSDK at root so it is at "/AndroidSDK". I dont know if this makes a difference.
I am actually running ubuntu 8.10 ha! I just tried to update But I keep getting errors! is there anything I can change to get this to work on ubuntu 8.10?
nicholasbithell said:
First I fixed the whole "couldnt find the (51-android.rules) file now I am having issues with executing ADB!
When in terminal this is what I get...
"[email protected]:/home/nick# /AndroidSDK/tools/adb
bash: /AndroidSDK/tools/adb: cannot execute binary file
[email protected]:/home/nick#"
and I also noticed something different from when I start terminal the first lines now state
"bash: : command not found
[email protected]:~$"
Edit: You state creating "Mount point: /AndroidSDK" During Installation, and what I did was Just place my AndroidSDK at root so it is at "/AndroidSDK". I dont know if this makes a difference.
I am actually running ubuntu 8.10 ha! I just tried to update But I keep getting errors! is there anything I can change to get this to work on ubuntu 8.10?
Click to expand...
Click to collapse
okay, a few things -
seems like your .bashrc file isn't setup right (?)
make sure that the two lines you inserted into it are on separate line
Code:
#AndroidDev PATH
export PATH=${PATH}:/AndroidSDK/tools
because maybe export PATH=${PATH}:/AndroidSDK/tools got commented on accident if you copy pasted.
When copying your SDK to the root of your filesystem, did you copy it as your own user or as root? you can use:
Code:
gksu nautilus
to copy system files with complete root privileges.
What exactly are you trying to update, Ubuntu or ... ? There shouldn't be a difference to get this working on 8.10, the only thing that seemed to change was the 51-android.rules file. Maybe this can help -
renaming it to 50-android.rules with
Code:
gksu nautilus
and deleting any backups (use CTRL+H to view hidden files).
restarting udev using:
Code:
sudo /etc/init.d/udev restart
Remember this is for 9.04, not 8.10. I hope this helps.
wddglr said:
okay, a few things -
seems like your .bashrc file isn't setup right (?)
make sure that the two lines you inserted into it are on separate line
Code:
#AndroidDev PATH
export PATH=${PATH}:/AndroidSDK/tools
because maybe export PATH=${PATH}:/AndroidSDK/tools got commented on accident if you copy pasted.
When copying your SDK to the root of your filesystem, did you copy it as your own user or as root? you can use:
Code:
gksu nautilus
to copy system files with complete root privileges.
What exactly are you trying to update, Ubuntu or ... ? There shouldn't be a difference to get this working on 8.10, the only thing that seemed to change was the 51-android.rules file. Maybe this can help -
renaming it to 50-android.rules with
Code:
gksu nautilus
and deleting any backups (use CTRL+H to view hidden files).
restarting udev using:
Code:
sudo /etc/init.d/udev restart
Remember this is for 8.10, not 9.04. I hope this helps.
Click to expand...
Click to collapse
Okay this is how I moved my "AndroidSDK" Folder to root....
[email protected]:~$ su
Password:
[email protected]:/home/nick# mv /home/nick/Desktop/AndroidSDK /
[email protected]:/home/nick#"
And I went to the bashrc file and it is entered in there correctly.
This is still what I get even after restarting Udev...
" bash: : command not found
[email protected]:~$ adb
bash: /AndroidSDK/tools/adb: cannot execute binary file
[email protected]:~$ su
Password:
[email protected]:/home/nick# adb
bash: adb: command not found"
Edit: This is what my .bashrc file looks like, well the top part of it anyways....
#AndroidDev PATH
export PATH=${PATH}:/AndroidSDK/tools
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
Okay your .bashrc is setup right and it's recognizing adb and its directory.
I would say it's something to do with permissions. since you moved it under su, you are not the owner so i would say that you'd have to change the permissions of /AndroidSDK
you can do that with -
Code:
gksu nautilus
Navigate to /
Right click on /AndroidSDK and select Properties
Click on Permissions tab
Select your user account as the owner
hopefully now it will function correctly
wddglr said:
Okay your .bashrc is setup right and it's recognizing adb and its directory.
I would say it's something to do with permissions. since you moved it under su, you are not the owner so i would say that you'd have to change the permissions of /AndroidSDK
you can do that with -
Code:
gksu nautilus
Navigate to /
Right click on /AndroidSDK and select Properties
Click on Permissions tab
Select your user account as the owner
hopefully now it will function correctly
Click to expand...
Click to collapse
I dont understand what this line does...
"gksu nautilus"
when i type it in it asks me for my administrative password and then after i put it in it hangs for a sec and then back to...
bash: : command not found
[email protected]:~$ gksu nautilus
[email protected]:~$
nautilus is the file browser, while using gksu nautilus you can use the file browser under root privileges
wddglr said:
nautilus is the file browser, while using gksu nautilus you can use the file browser under root privileges
Click to expand...
Click to collapse
I dont have Nautilus as a file browser I have Thunar I believe.
Then gksu thunar
wddglr said:
nautilus is the file browser, while using gksu nautilus you can use the file browser under root privileges
Click to expand...
Click to collapse
For permissions it says that I am the owner and the group (I=Nick) for Others it says Read and Write, Access says Read and write. So it seems it has all the right permissions. Any other Ideas?
Partitioning HD
First off, thank you for this thread, it's most excellent. I have a question that is slightly off topic, but not so much. I have Ubuntu 9.04 installed on my recovery partition. This partition is only 10 GB, while I have Vista on my main. I have almost 100 GB free on my main drive, and what I want to know is, if I resized my partitions to give more space to Ubuntu, how would it affect my comp? (if at all). And which OS should I be on while resizing, Ubuntu or Vista?

[HOWTO] Guide to running ADB under Fedora 11 (and equivalent distros)

Ok, I have fedora 11 installed on most of my computers, since i love this distro to death. My big thing was trying to get adb to work. This is my guide to get it to work, for now.
First things first. Navigate to /etc/udev/rules.d as root. Create a rules file called 50-android.rules (touch 50-android.rules). NOTE: You are better off looking at the contents and picking a rules number set other than what is listed. Sometimes udev is picky. For the newbies, so if any rules start with '50', then change the number by one or two, like 51 or 52. Paste this into the file:
Code:
SUBSYSTEM=="usb",ATTRS{idVendor}=="0bb4",SYMLINK+="android_adb",MODE="0666"
Make sure you use ATTRS, not ATTR or SYSFS, since this is a newer updated udev system.
After that, run udevadm control --reload-rules to reload your rules files. Now just run ./adb devices as root to make sure it recognized your HTC dream. I am working on this fix right now so you don't need to be root, keep patient. Now you can adb shell into your device either as root OR normal user, just as long as you start the server as root. This is a permissions problem, and hopefully I can fix this and/or find a fix soon.
I wrote this because i searched high and low through google, and only found a few good parts as far as a fix. Hopefully this helps a few people out there.
Just wondering if this has helped anyone. If not, delete this thread or do whatever with it....
I have adb on my eeepc 900 with f11 I believe this method works too as well. although it says it has been tested with ubuntu, it works pretty well with f11.
http://www.talkandroid.com/android-sdk-install-guide/
Installing The Android SDK
First you will need to download the Android SDK pack .zip archive, once downloaded find a suitable installation location on your machine and extract the zipped files.
Please note: This installation location will be referred to as $SDK_ROOT from now on through this tutorial
Alternatively you can add /tools to your root path which will prevent the need to specify the full path to the tools directory along with enabling you to run Android Debug Bridge (adb) along with other command line tools.
To add /tools:
Linux
1. Edit the ~/.bash_profile or ~/.bashrc files looking for a line that sets the PATH variable.
2. Add the full path location to your $SDK_ROOT/tools location for the PATH variable.
3. If no PATH line exists you can add the line by typing the following:
4. export PATH=${PATH}:<path to your $SDK_ROOT/tools>
Click to expand...
Click to collapse
It helped me, since the creation of the file my OpenSuSE 11.0 recognizes the phone perfectly
Thanks a lot for your hint.
thanks it helped me. ill be looking forward to getting it to work without root
just use sudo instead
Just a heads up for user's using Ubuntu 9.10, this isn't needed. I connected my G1 to it and ran ADB with no adjustments to udev or anything else.
Pretty much it works out of the box.
Here is my version
download the .tgz file from googlecode
http://developer.android.com/sdk/index.html
sudo tar -xzvf android-sdk_r3-linux.tgz
Click to expand...
Click to collapse
Code:
sudo gedit ~/.bash_profile
heres my bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH=$PATH:/android-sdk-linux/tools
Click to expand...
Click to collapse
logout
login
connect android g1 device via usb to pc
open a terminal
Code:
adb devices
if you cant get a device try it with superuser.
Don't you think that this is all just a little bit excessive?
To make it work in F11, just do this;
Download SDK, extract.
To use, type:
/path/to/sdk/tools/adb
Another option is to edit the /etc/profile and add
PATH=$PATH:/<Path to android-sdk>/tools
This option will allow any user to use the adb tools when logged in or if you
su -
into another user
I wrote a short guide as well for Windows and Ubuntu. Might help others.
Unfortunately, as anyone with a passing acquaintence with ADB knows, the scrolling issue can be a killer. I swear the other day I pressed "up" twice and it composed "rm /sdcard/rootfs.img /sdcard/system.ext2" and executed it. We run Android on our SD's btw.. Was not cool. Instead, I use ADB via telnet and it works beautifully. Here's how:
Code:
adb shell telnetd &
adb forward tcp:9999 tcp:23
Now type this: "telnet localhost 9999"
Enter "root" and hit enter
Finally update PATH: "export PATH=/usr/bin:/usr/sbin:/bin:/sbin:/system/sbin:/system/bin:/system/xbin:/system/xbin/bb:/data/local/bin"
Okay, so 4 lines to enter and you have a "regular, sane" shell connection to the phone and you can actually scroll through history and text without it jumbling the text and executing random code. Enjoy.
lbcoder said:
Don't you think that this is all just a little bit excessive?
To make it work in F11, just do this;
Download SDK, extract.
To use, type:
/path/to/sdk/tools/adb
Click to expand...
Click to collapse
that works too as well but i would rather open up a terminal and type
sudo adb devices
sensimila said:
that works too as well but i would rather open up a terminal and type
sudo adb devices
Click to expand...
Click to collapse
WHY would you want to make it *MORE COMPLICATED*??
There is NO NEED for root.
/path/to/adb ...
THATS ALL.
This is kind of funny... i wrote this because i had trouble with it, so i am just sharing my fix...
In case this is interesting to someone:
The fix mentioned in the first post has to be applied to open SuSE x86 and x64 edition to make the G1 work. The external device works without it, but not the adb device.
Thanks again!
Just wanted to come and post that this does work with OpenSUSE 11.2 x86. Did this hoping to get adb to work with my LG Ally and it does. Thanks!
(Still) works for me on 64bit SUSE 11.4.
Before adding this file, I could not access my device with adb, received permissions errors.
Added this file, and I can shell into my device.
Permissions on adb itself was not the problem, it was access to the device when udev found it.
[edit]Actually used the lines from http://developer.android.com/guide/developing/device.html[/edit]

[GUIDE] Full bash shell with nano, tab completion, and color over ssh and adb

Posting this here because I think it will be of more interest to the tinkerers/devs than general users, if not, feel free to move it. I cobbled all of this together from various places on the web, but I think the credit for the binaries goes to Paul @ MoDaCo.
Nandroid before going any further!
Files you'll need:
For WiFi and CDMA SSH access - QuickSSHD (Download this from the Market. $1.50). I'm just going to assume if you're still reading, you know what this is for and how to use it. It's braindead simple. I think dropbear can be installed and configured manually, but for the $1.50...meh.
adb for tethered access.
The rest are zipped up here: terminfo, nano, bash, profile**
Unzip bashnano.zip onto your SDCard.
adb remount
From adb shell:
Install Terminfo:
cp -r /sdcard/terminfo /system/etc
Setup Bash:
cp /sdcard/bash /system/bin/bash_new
mv /system/bin/sh /system/bin/sh.old
ln -s /system/bin/bash_new /system/bin/sh
mv /sdcard/profile /sdcard/bash_profile (Thanks to jjvcuyler for finding adb bash profile location.)
Setup Nano:
cp /sdcard/nano /system/bin
I'm not sure if this setup will have any impact on sh scripts being used in the various ROMs, so use this at your own risk. I think it would kick ass to see this type of bash functionality baked into the custom ROMs.
If anybody would like to make this a flashable.zip, please do. I don't know how to do that yet.
Anyway, hope y'all find it useful.
**profile reflects a few personal choices for aliases and colors, but you can edit to your personal taste.
So I just did this. Is there any way to get this functionality into a local terminal?
Also I was able to do everything from a local terminal without adb. Just do the following first:
su
remount rw
Click to expand...
Click to collapse
adb shell fires off bash, but it doesn't read profile from /etc. It's going to be a simple matter of figuring out where bash is looking for it. I just haven't found that out yet.
How do you like having full bash capabilities on EVO? Arrows/tab completion/color prompts, etc...
J
jmxp69 said:
adb shell fires off bash, but it doesn't read profile from /etc. It's going to be a simple matter of figuring out where bash is looking for it. I just haven't found that out yet.
How do you like having full bash capabilities on EVO? Arrows/tab completion/color prompts, etc...
J
Click to expand...
Click to collapse
Copy profile to /sdcard/bash_profile
jjvcuyler said:
Copy profile to /sdcard/bash_profile
Click to expand...
Click to collapse
WooT! There it is. I'll update the OP. Thanks jjvcuyler.
Edit: /sdcard/bash_profile works for ssh and adb. OP updated to reflect the change.
jmxp69 said:
Posting this here because I think it will be of more interest to the tinkerers/devs than general users, if not, feel free to move it. I cobbled all of this together from various places on the web, but I think the credit for the binaries goes to Paul @ MoDaCo.
Nandroid before going any further!
Files you'll need:
For WiFi and CDMA SSH access - QuickSSHD (Download this from the Market. $1.50). I'm just going to assume if you're still reading, you know what this is for and how to use it. It's braindead simple. I think dropbear can be installed and configured manually, but for the $1.50...meh.
adb for tethered access.
The rest are zipped up here[/URL]: terminfo.zip, nano, bash, profile**
Unzip bashnano.zip onto your SDCard.
Unzip terminfo.zip (from inside bashnano.zip) onto your SDCard.
adb remount
From adb shell:
Install Terminfo:
cp -r /sdcard/terminfo /system/etc
Setup Bash:
cp /sdcard/bash /system/bin/bash_new
mv /system/bin/sh /system/bin/sh.old
ln -s /system/bin/bash_new /system/bin/sh
mv /sdcard/profile /sdcard/bash_profile (Thanks to jjvcuyler for finding adb bash profile location.)
Setup Nano:
cp /sdcard/nano /system/bin
I'm not sure if this setup will have any impact on sh scripts being used in the various ROMs, so use this at your own risk. I think it would kick ass to see this type of bash functionality baked into the custom ROMs.
If anybody would like to make this a flashable.zip, please do. I don't know how to do that yet.
Anyway, hope y'all find it useful.
**profile reflects a few personal choices for aliases and colors, but you can edit to your personal taste.
Click to expand...
Click to collapse
there is no terminfo.zip and there is nothing in terminfo directory from within the original zip... help?
Sorry, I missed the recurse flag zipping the terminfo directory. It's fixed now. Go ahead and re-download.
Here's a link for just terminfo.zip
J
I modified the bash_profile to get rid of the colors since the window's cmd.exe doesnt support ansi colors. probably a better way to do this but it works for me.
also found this useful for setting PS1 to my liking http://www.cyberciti.biz/tips/howto-linux-unix-bash-shell-setup-prompt.html
jmxp69 said:
adb shell fires off bash, but it doesn't read profile from /etc. It's going to be a simple matter of figuring out where bash is looking for it. I just haven't found that out yet.
How do you like having full bash capabilities on EVO? Arrows/tab completion/color prompts, etc...
J
Click to expand...
Click to collapse
is there a way to get tab completion through adb shell?
Yes. This works with adb shell. Just follow the directions in the OP.
jmxp69 said:
Yes. This works with adb shell. Just follow the directions in the OP.
Click to expand...
Click to collapse
i have and i do have everything done as stated in the OP, when i try tab completion via adb shell (phone tethered with usb) from my pc, it just puts in a tab, it doesn't complete.
Hmm....could be a dos thing with cmd.exe. I haven't tried on a PC, I'm on a Mac. adb shell via OSX works fine with tab completion. Try ssh'ing in instead with something like putty? Once you get ssh going, you don't need a cable.
Edit: Confirmed...tab completion doesn't work over Win cmd.exe and adb shell.
jmxp69 said:
Hmm....could be a dos thing with cmd.exe. I haven't tried on a PC, I'm on a Mac. adb shell via OSX works fine with tab completion. Try ssh'ing in instead with something like putty? Once you get ssh going, you don't need a cable.
Edit: Confirmed...tab completion doesn't work over Win cmd.exe and adb shell.
Click to expand...
Click to collapse
Thanks for looking into it... I'll try getting it to work via linux instead. I guess ssh would be a solution, but i never turn wifi on.
Is anyone able to do a NAND backup/restore after doing this? With Amon Ra's recovery I was unable to NAND backup.
EDIT:
I think this is a big negatory. I was just able to do a NAND backup, so maybe the error I got was a coincidence after applying these changes.
Anyone else noticing that the time is always displayed as GMT in the prompt? The date command gives the correct time for my timezone but the bash prompt always shows GMT
Vinny75 said:
Anyone else noticing that the time is always displayed as GMT in the prompt? The date command gives the correct time for my timezone but the bash prompt always shows GMT
Click to expand...
Click to collapse
Change PS1 line: \A to `date +%H:%M`
jmxp69 said:
Posting this here because I think it will be of more interest to the tinkerers/devs than general users, if not, feel free to move it. I cobbled all of this together from various places on the web, but I think the credit for the binaries goes to Paul @ MoDaCo.
Nandroid before going any further!
Files you'll need:
For WiFi and CDMA SSH access - QuickSSHD (Download this from the Market. $1.50). I'm just going to assume if you're still reading, you know what this is for and how to use it. It's braindead simple. I think dropbear can be installed and configured manually, but for the $1.50...meh.
adb for tethered access.
The rest are zipped up here: terminfo, nano, bash, profile**
Unzip bashnano.zip onto your SDCard.
adb remount
From adb shell:
Install Terminfo:
cp -r /sdcard/terminfo /system/etc
Setup Bash:
cp /sdcard/bash /system/bin/bash_new
mv /system/bin/sh /system/bin/sh.old
ln -s /system/bin/bash_new /system/bin/sh
mv /sdcard/profile /sdcard/bash_profile (Thanks to jjvcuyler for finding adb bash profile location.)
Setup Nano:
cp /sdcard/nano /system/bin
I'm not sure if this setup will have any impact on sh scripts being used in the various ROMs, so use this at your own risk. I think it would kick ass to see this type of bash functionality baked into the custom ROMs.
If anybody would like to make this a flashable.zip, please do. I don't know how to do that yet.
Anyway, hope y'all find it useful.
**profile reflects a few personal choices for aliases and colors, but you can edit to your personal taste.
Click to expand...
Click to collapse
I followed the steps exactly, but end up with "- exec '/system/bin/sh' failed: Permission denied (13) -" while typing "adb shell" in a windows or linux terminal. I cannot recover the original sh because the root is lost, and I cant root my phone anymore probably because something wrong with the new sh. Any idea how to fix this?
EDIT: Acutally nevermind. adb shell works in recovery mode. but still, not sure why the modified sh doest work for me
The Downloadlink is dead!
So the thread is useless.
francwalter said:
The Downloadlink is dead!
So the thread is useless.
Click to expand...
Click to collapse
Yeah.....no.
A simple google search would have shown you that the files are here: http://66.197.42.222/bashnano.zip
or here http://androidforums.com/attachment...ide-installing-bash-nano-android-bashnano.zip.
EDIT: I've also attached it in case the links above ever die, there will still be one which does not.
ya this is great and all but any decent busybox installer will setup bash for you.

[Q] ADB doesn't work on Mac

When I CD to the platform-tools folder and type
Code:
adb devices
it says "adb: command not found" If anyone could help me that would be wonderful. I am on the Inspire/DesireHD running AOSP Gingerbread. Thanks!
You have two choices. You can either run the command prefixed with ./ (dot slash), which allows for executing an executable in the current directory:
Code:
./adb devices
Or, the other choice (which will be better if you intend to use adb a lot) is to add the platform-tools folder to your path by editing or creating the file .bashrc in your home folder (~/.bashrc).
Let's suppose your platform tools folder is: ~/.android-sdk/platform-tools
Then, you would want to add something along the lines of the following to your bashrc:
Code:
export PATH="$PATH:$HOME/.android-sdk/platform-tools"
Save the file, the run this or log out/in:
Code:
source ~/.bashrc
Et voila, you should now be able to run adb from any folder without issue.
Explanation: adding the new path (folder) to your PATH environment variable tells BASH to include that folder in its search for an executable. The reason $PATH is added at the beginning of the new string is so that your default path does not get overwritten. $HOME will simply expand to /home/your_user_name when BASH interprets it.
GENIUS! IT WORKED! Thank you! Now, one more question- how do I get superuser privileges using ADB? (device is rooted, of course)
No problem.
On my G1 you were root as soon as you adb'd in. Just tested on my Defy and '$' - shocking. So once you have run adb shell, just run 'su' (without quotes of course) and accept the permission on your phone screen as usual for root programs and you should be good to go.
Sorry to keep asking questions, but when I typed
Code:
su
into adb, it asked for a password. No popup on device screen. I do have superuser installed on the device.
That is odd. I'm not sure why that would be. I'll see if I can think of something though. Hopefully someone else can make a suggestion.
Thanks! You have been very helpful.
Don't think I can hit the thanks button from the app, sorry
Sent from my Inspire 4G using XDA App

Categories

Resources