How to Use Android ADB Command Line Tool

Android Debug Bridge (adb) is a tool that lets you manage the state of an emulator instance or Android phone. ADB is bundled with Android SDK package that can be downloaded from Android SDK download page. This tool is usefull for communicating with Android phone such as install application, copy files from/to device and perform some linux shell commands.
How to Install
  • Download and install Java SDK (Ex: jdk-6u20-windows-i586.exe)
  • Download Android SDK package (Ex:
  • Extract SDK package into anywhere on your drive (Ex: D:\android-sdk-windows)
Phone Setup
In order to use ADB, you have to enable USB Debugging option in  phone settings (Settings->Applications->Development)

How to Use
  • Connect the phone to your pc/notebook usb port
  • Run Windows command line tool (cmd) and go to D:\android-sdk-windows\tool
New Android SDK puts adb executable file on \platform-tools directory instead of tool. So the path should be D:\android-sdk-windows\platform-tools
Usefull Commands
1. Check connected phone
Syntax: adb devices

2. Login to Android shell
Syntax: adb shell

If you get ‘#’ after typing adb shell, you are already get root access on the phone, no need to type su. Otherwise if you get ‘$’ , type ’su’ to get root access (only for rooted device).
3. Some usefull shell commands
  • ls
  • List directory Syntax:  ls [path] Example: #ls /system/lib
  • cp
  • Copy file or directory Syntax: cp [options] source dest Note: To copy or delete files in Android root directories you have to change the directory access mode to ‘read and write (rw)’ using command: remount rw Example: #remount rw #cp /sdcard/ /system/lib #remount ro
  • mv
  • Move file or directory Syntax: mv [options] source dest Example: #mv /system/lib/ /sdcard/backup
  • chmod
  • Change file/directory permission Syntax: chmod [-R] mode[,mode] …. file Example: #chmod 0644 /system/lib/
  • rm
  • Remove file or directory Syntax: rm [options] file Example: #rm /system/lib/
4. Install application

You can use adb to install aplication from your local drive into  phone.
Syntax: adb install appname.apk
D:\android-sdk-windows\tools\adb install D:\AnReboot.apk

5. Copy files from phone to local drive
Syntax: adb pull source [destination]
D:\android-sdk-windows\tools\adb pull /sdcard/
D:\android-sdk-windows\tools\adb pull /sdcard/ D:\

5. Copy files from local drive to phone
Syntax: adb push source destination
D:\android-sdk-windows\tools\adb push D:\AnReboot.apk /sdcard

No comments:

Post a Comment

We love to hear from you! Leave us a comment.