I'm ready to interact with the ADB. What do I need to know?
The Android Debug Bridge is very similar to your command prompt (DOS prompt) or your terminal in mac. When you're in the
ADB, you're accessing the phone itself as long as your phone is connected. Your phone does not need to be connected as a disk drive, but your phone does need to have "Debugging Mode" enabled. The way you interact with the
ADB is by navigating through the files on your computer or phone and issuing commands.
What do you mean by "navigating through the phone"?
If you locate an executable in the
SDK titled "
adb", usually located in the "
tools or
platform-tools folder, and you double click it, you'll see your terminal or command prompt open and execute a whole list of commands. Don't worry, these are just basic commands you can issue in the
ADB. Go ahead and read some of the lines, it's actual information you should know. An example of navigating through the phone would be as follows.
Let's say you want to find a picture on your computer in the
ADB. If you double clicked on that
adb executable, you'll need to open another window with a prompt ready to receive commands, you'll have to do this with terminal. Usually you'll start out at your default or home folder. For me on my MAC, i'll get the prompt -
new-host:~ TruSlide$
Here i'll be able to enter commands. To make things simple, lets say that picture is on your desktop. If you simple type ls (Lower case L and S), you'll receive a list of where you can navigate to. ls is the list command. Try it out. Now you can navigate to your desktop once you see it listed.
I typed desktop and it rejected my command and didn't navigate there. What happened>
Don't worry, the next thing you need to know is the "cd" command. cd stands for
change directory. This tells the terminal to change the directory to ~. Try it out, type cd
location. (Location is the name of your desktop or whatever folder you see when you type ls.)
[color="red"]The
cd command is very important because in order to perform many of these functions, you're going to need to navigate to the folder that
adb executable we talked about earlier is located. Mine is on my desktop, in my
SDK folder, in my tools folder. So to give you an idea of how I would navigate there, I would type
cd desktop/
SDK/tools
Now i'll be in the tools folder and I can start issuing some of the below commands.
Ok cool, tell me about some more commands and the ADB.
pwd - will show you your current location on your computer
cd .. - this will take you back a folder, kind of like backing up or moving back
adb shell - this will access a shell within the phone and let you enter commands directly
adb shell reboot recovery - this will do what it says. It commands the phone to reboot into recovery
adb remount rw - mounts for read/write (r.w.)
adb remount ro - mounts for read only (r.o.)
adb push <localfile> <location> - will push a file from
localfile(on computer) to
location adb pull <location> <localfile>- will copy a file from
location(on your phone) to
localfile adb root - restarts the adbd daemon with root permissions (doing this wont give you ROOT) nice try
adb usb - restarts the adbd daemon listening on USB
adb devices - will list your device information
adb start-server - starts the connection to the phone
adb kill-server - kills the connection to the phone
su - SuperUser. typing this may prompt a password. Then you'll see s-h3.2$ or #. $means no root, # means root.
exit - leaves the
su
logout - logs out of the server
adb logcat - will start logging EVERY event that occurs on your phone. Try it, then wake you phone up, open an app, and watch the
adb. To exit you'll need to do ctrl+c. or you'll need to close the window.
adb shell cat /proc/meminfo - will display how much RAM is on your device. Useful for debugging or verifying your phone info
Here's an example of working in the
adb
Lets say you have the exploit rageagainstthecage-arm5.bin and it is on your sdcard. The location is /sdcard/exploit/rageagainstthecage-arm5.bin, now you want to work with this file. Here is your interactive example...
adb shell cat /sdcard/exploit/rageagainstthecage-arm5.bin > /data/local/tmp/rageagainstthecage-arm5.bin (This line means that you are moving the rage exploit from the /sdcard/exploit/ to /data/local/tmp)
Once this is done, you'll now have rage in /data/local/tmp
Next you would type :
adb shell chmod 0755 /data/local/tmp/rage... (this tells the device that youre going to make a change)
chmod is change mode adb shell ./data/local/tmp/rage.... (This runs the rage exploit)
So what you can take away with this information is inside an
ADB SHELL, you are issuing a command WITHIN the device.
I want to root my phone How do I do it in the ADB.
You'll have to understand the root process first and foremost. The most recent, easy, Root process works be running an exploit on your phone followed by a downgrade to an easier version of android that can be rooted when you run a program like unrevoked or simple root. I don't know how they write their exploits so I cant tell you about that information. What I can tell you is that the step by step process is very specific. Please refer to the link below about "Common misconceptions" to learn more about root. The main thing you'll be running is a .bin file. This is the exploit. What you'll end up doing is either MOVING or PUSHING this to another part of your SD card. I'm not speaking for ALL root methods, just in this instance. Then you will identify that file as executable by typing chmod - which is Change Mode. Finally, you'll execute the change.
Remember take note of the Spaces between words and upper and lower casing. Everything must be exact when doing this. Lets talk about BASH. You'll see it, so I'll explain it
Bash is an environment that can store larger amounts of data unlike DOS. Without overwhelming the reader, see the link below about the BASH information. This is just a brief explanation of BASH.