16 Jan 2015

Basic Adb and Fastboot commands that you should know


Android debug bridge is command line program  that can be used to connect to a android device or to any emulator.its basically like command prompt in windows.It is part of software development  tools.


Fastboot is a small part of sdk which is can be used to reflash partitions of android devices like unlocking bootloader,re-lock bootloader, installing recoveries,boot files,system images  etc.

Must read:


1.download and install Sdk tools or minimal fastboot.
2.connect the phone to computer via usb cable.
3.Enable usb debugging. Go to about phone.Tap on build no. till you see "you are now a developer".
4.after connect the device you will notice a pop up from the usb debugging to allow for connection.tick on "always allow from this computer".

ADB commands:

1.ADB Devices:

1.The first command we will be ;earning is to find if your device is recognized by adb.
open the adb shell an type"adb devices" this command to know if your device is recognized by adb.
if no device if found it shows blank after list of devices attached if found  serial no. will be displayed

Must read: Basic android terms

adb when no device attached adb when device is attached

2.ADB pull:

This command is used to pull files from the devices.u need to know the right path of file being pulled and the desitination other wise files will be pulled to plat-form tools of sdk.
type adb pull <location of file to be pulled>  < destination if  file to be placed>

adb pull adb pull executed

3.ADB push:

if you want to send/copy a file to device then type adb push <address of file to be pushed> <location where you want to copy>
adb push adb push executed

4.adb install:

You can install apps using adb shell with this command.type adb install <location of apk to be installed>
adb install

5.adb kill-server:

Even after installing all drivers properly sometime the device may not be recognized by the server then you need to stop the adb. to stop adb server type "adb kill-server"
adb kill-server adb kill-server executed

6.adb start-server:

after stopping the adb server you need to start the server again.type adb start-server

adb start-server

7.adb shell su:

To run Adb in superuser mode type adb shell su.you will notice a pop up on phone to grant superaccess.You will not be able to run adb in su mode on stockroms. 
adb shell su run in supersu adb shell su

8.adb reboot:

To restart your phone use "adb reboot" .you can reboot to bootloader or recovery by using "adb reboot bootloader " "adb reboot recovery"

Fastboot commands:

These commands can be used only when you connect the device in fastboot mode

1.Fastboot devices:

make sure that all the drivers are installed properly. 
First command after connecting the device would be fastboot devices.to know if your device is detected.If device is detected you will notice a "serial no.  fastboot" otherwise it shows no devices attached or just fastboot.If device is not detected reinstall all the drivers. 

fastboot devices

2.Fastboot Reboot:

"fastboot reboot"-Device reboots normally after typing this command
"fastboot reboot-bootloader":Device will reboot to bootloader

3.Fastboot flash: fastboot flash <partition>  <filename>

we a list command under this flash tag:

a.Fastboot flash boot boot.img:

 by using this command you will be flashing boot image.make sure that boot.img file is located in  same folder as that of adb or  locate the path to boot.img

b.Fastboot flash system system.img:

To Flash system image use this command

c.Fastboot flash recovery recovery.img:

use this command to flash recovery

4.Flashboot erase: flashboot erase <partition>

This command is used to erase partitions like system,sdcard etc.

make sure you are using right flash commands while flashing. you cannot use fastboot flash boot command for flashing recovery or system image .you may brick the device.

Final words:

These are some of the basic adb and fastboot commands that you should be aware of if you falshing any custom roms or kernels.Of cource you can flash roms without fastboot commands that is through recovery but these command might help you in long run when your devices  fails to flash roms through recovery or while using images instead of zip files.
Basic Adb and Fastboot commands that you should know Reviewed by Radha Krishna on 20:26 Rating: 5 ADB: Android debug bridge is command line program  that can be used to connect to a andr...

No comments: