ADB (Android Debug Bridge) is a tool that comes with the Android SDK that allows you to control and interface with your Android device. It is located in the tools folder when you unpack the SDK.
Source: ADB
Commands
Adb has many built in commands. Some are interactive (meaning they keep running until you stop them) and some just perform a simple task. Below is a list of the commands in the 1.0 SDK version of adb.
Android Debug Bridge version 1.0.20
-d - directs command to the only connected USB device
returns an error if more than one USB device is present.
-e - directs command to the only running emulator.
returns an error if more than one emulator is running.
-s
the given serial number
-p
a relative/absolute path to a product
out directory like 'out/target/product/sooner'.
If -p is not specified, the ANDROID_PRODUCT_OUT
environment variable is used, which must
be an absolute path.
devices - list all connected devices
device commands:
adb push
adb pull
adb sync [
(see 'adb help all')
adb shell - run remote shell interactively
adb shell
adb emu
adb logcat [
adb forward
forward specs are one of:
tcp:
localabstract:
localreserved:
localfilesystem:
dev:
jdwp:
adb jdwp - list PIDs of processes hosting a JDWP transport
adb install [-l] [-r]
('-l' means forward-lock the app)
('-r' means reinstall the app, keeping its data)
adb uninstall [-k]
('-k' means keep the data and cache directories)
adb bugreport - return all information from the device
that should be included in a bug report.
adb help - show this help message
adb version - show version num
DATAOPTS:
(no option) - don't touch the data partition
-w - wipe the data partition
-d - flash the data partition
scripting:
adb wait-for-device - block until device is online
adb start-server - ensure that there is a server running
adb kill-server - kill the server if it is running
adb get-state - prints: offline | bootloader | device
adb get-product - prints:
adb get-serialno - prints:
adb status-window - continuously print device status for a specified device
adb remount - remounts the /system partition on the device read-write
networking:
adb ppp
Note: you should not automatically start a PDP connection.
[parameters] - Eg. defaultroute debug dump local notty usepeerdns
adb sync notes: adb sync [
- If
- If it is "system" or "data", only the corresponding partition
is updated.
Common Use
Some of the more common commands in adb are push, pull, shell, install, remount, and logcat.
Push sends a file from your desktop computer to your Android device:
adb push test.txt /sdcard/test.txt
Pull pulls a file from your Android device to your desktop computer:
adb pull /sdcard/test.txt test.txt
Shell lets you run an interactive shell (command prompt) on the Android device:
adb shell
Install lets you install an android APK file to your Android device:
adb install myapp.apk
Remount remounts the /system partition as writable (or readonly if it is already writeable):
adb remount
Logcat lets you view the devices debug logs in real time (must press control+c to exit):
adb logcat
----------------
Through ADB
Pull apps off phone onto computer
Code:
adb pull /system/sd/app app
adb pull /system/sd/app-private app-private
Push apps back to phone from the computer
Code:
adb push app /system/sd/app
adb push app-private /system/sd/app-private
Delete existing apps on SD
Code:
adb shell rm -r /system/sd/app
adb shell rm -r /system/sd/app-private
Through Terminal
Partition SD card - This erases everything on your SD card (*size* being the size of the FAT32 partition)
Code:
$ su
# cd /data
# wget http://64.105.21.209/bin/lib/droid/sdsplit
# chmod 555 sdsplit
# /data/sdsplit -fs *size* (add -nc to the end for JFv1.5ADP)
From the Recovery Screen
Sending an update file to your SD card:
Code:
adb shell mount /sdcard
adb shell rm /sdcard/update.zip
adb push *filename* /sdcard/update.zip
From Fastboot
Restoring a nandroid backup - Start command-prompt/terminal cd to the nandroid folder and enter following commands
Code:
fastboot erase boot
fastboot erase recovery
fastboot flash system system.img
fastboot flash boot boot.img
fastboot flash userdata data.img
fastboot flash recovery recovery.img
fastboot reboot
------------
Basic Android Terminal and ADB Shell Command List
1. How to open a cmd in Android Phone
Method 1: “Start” – “”Program”-” “Accessories” – “” Command Prompt ”
Method 2: “Start” – “” Run “, type cmd ENTER
2. How to restart Android Phone
When the phone and Computer is connected to the data cable, you can enter the following command
view source
print?
1 adb shell reboot === ENTER
3. Restart Android into Recovery Mode
With the data cable connected to your phone and computer, enter the following command
view source
print?
1 adb shell reboot recovery === ENTER
4. Convert back to ext2 partition
Restart the phone into Recovery mode, press “Alt + X” into the console. Open cmd and enter the following command
view source
print?
1 adb shell === ENTER
2 tune2fs-O ^ has_journal / dev/block/mmcblk0p2 === carriage return
3 e2fsck / dev/block/mmcblk0p2 === carriage return (optional, can be a problem area in section 2, when used)
5. Pulling applications from Android phone to computer
view source
print?
1 adb pull /system/sd/app app
2 adb pull /system/sd/app-private app-private
6. Pushing applications back to android phone from the computer
view source
print?
1 adb push app /system/sd/app
2 adb push app-private /system/sd/app-private
7. Delete existing apps on Android SD
view source
print?
1 adb shell rm -r /system/sd/app
2 adb shell rm -r /system/sd/app-private
8. Repair gravity System or switch to screen
Sometimes frequent brushing of phone can cause gravity system or switch to screen failure. Just follow the steps below-
Restart the phone into Recovery mode, press “Alt + X” into the console
Open cmd and enter the following command
view source
print?
1 mount / data === carriage return
2 rm / data / misc / akmd * / data / misc / rild * === ENTER
9. Ext2/ext3/ext4 formatted partition
Enter the following command in the cmd
view source
print?
1 adb remount === ENTER
2 adb shell === ENTER
3 rm-r / system / sd / * === carriage return
10. Remove/ system / app under the application
Under normal circumstances / system / app is not under an application. Use the following methods to remove these applications.
Open cmd and enter the following command
view source
print?
1 adb remount === ENTER
2 adb rm / system / app / Stocks.apk === Enter
11. If the start Time is too Long
Just enter the following command in order to view the boot process.
view source
print?
1 adb logcat === ENTER
12. Through Terminal Partition SD card
It will erase everything on your SD card
view source
print?
1 $ su
2 # cd /data
3 # wget http://64.105.21.209/bin/lib/droid/sdsplit
4 # chmod 555 sdsplit
5 # /data/sdsplit -fs *size* (add -nc to the end for JFv1.5ADP)
13. From the Recovery Screen, send an update file to your SD card.
view source
print?
1 adb shell mount /sdcard
2 adb shell rm /sdcard/update.zip
3 adb push *filename* /sdcard/update.zip
14. Restoring a nandroid backup via Fastboot
Start command-prompt/terminal cd to the nandroid folder and enter following commands
view source
print?
1 fastboot erase boot
2 fastboot erase recovery
3 fastboot flash system system.img
4 fastboot flash boot boot.img
5 fastboot flash userdata data.img
6 fastboot flash recovery recovery.img
7 fastboot reboot
15. Clear Search History in Android
Search History is accounted for Mobile Memory. It can also leak your privacy information as well. Just follow the steps below to clear android history.
Steps are as follows:
1. Make sure your mobile phone has Root authority.
2. Open the super-terminal.
3. Enter the following command
view source
print?
1 su
2 rm / data / data / com.android.vending / databases / suggestions.db
4. Exit Hyper Terminal and restart the phone.
Thanks to :
http://forum.xda-developers.com/showthread.php?t=517874
http://www.gadgetsdna.com/android-terminal-adb-shell-command-list/1168/
http://android-dls.com/wiki/index.php?title=ADB
No comments:
Post a Comment