All ADB and Fastboot commands Explained

12:19 Alex 0 Comments




ADB stands for Android Debug Bridge, and it allows you to communicate with your Android device using your computer. For instance, if you wish to install an app on your device right from your desktop, you can do so using ADB. There is a lot more you can do with ADB than just installing an app. Having knowledge of some of the most used ADB commands is really beneficial, as it will let you perform a number of actions on your device without even touching it. Here, we have compiled some of the common commands that you can use with ADB to perform actions on your device.

Short terms used in the guide:
1. <Local> - Android Device Storage
2. <Remote> - PC/External Device
2. < >  - write command without "< >"

ADB Commands

1. List all connected devices
Command:
adb devices
This command show you a list of all devices connected to the computer.

2. Copy host->device only if changed
Command:
adb sync [ <directory> ]
This command is used to synchronize host and local device.

3. Enter remote shell interactively
Command:
adb shell
This command is used to enter the shell of device.

4. Run remote shell command
Command:
adb shell <command>
This command is used to run specific shell commands on device.

5. Send File to your Device
Command:
adb push <Source Destination>
The above command lets you send files to your device. You just need to specify the source location of the file in the source argument in the command and the destination where you want to send your file. 
Example:
  • adb push <local> <remote>
  • adb push test.apk /sdcard
  • Copies <android-sdk-path>/platform-tools/test.apk to /sdcard directory.
  • adb push d:\test.apk /sdcard
  • Copies d:\test.apk to /sdcard directory.
6. Get File from your Device
Command:
adb pull <FileLocation Destination>
It will let you pull, or in other words, receive a file from your device. Just specify the file location on your device and the destination in the command, and it should do the job for you.
Example:
  • adb pull <remote> [local]
  • adb pull /sdcard/demo.mp4
  • download /sdcard/demo.mp4 to <android-sdk-path>/platform-tools directory.
  • adb pull /sdcard/demo.mp4 e:\
  • download /sdcard/demo.mp4 to drive E.
7. Install an App on your Device
Command:
adb install <apk path>
What this command does is let you install an app on your device right from your computer. You just need to specify the APK location in the command, and it will install the selected app on your device.
Example:
  • adb install [option] <path>
  • adb install test.apk
  • adb install -l   -  means forward lock the application
  • adb install -r   -  means reinstall the app, keeping its data
  • adb install -t   -  means allow test packages
  • adb install -s   -  means install application on sdcard
  • adb install -d   -  means allow version code downgrade
  • adb install -p   -  means partial application install
8. UnInstall an App on your Device
Command:
adb uninstall <APKLocation>
What this command does is let you uninstall an app on your device right from your computer. You just need to specify the APK location in the command, and it will uninstall the selected app on your device.
Example:
  • adb uninstall [option] <path>
  • adb uninstall test.apk
  • adb uninstall [-k]   -  means keep the data and cache directories
9. Remount the System
Command:
adb remount
In case you want to remount the entire system of your device, you can issue the command mentioned above.

10. Take a Logcat
Command:
adb logcat
Logs from various applications and portions of the system are collected in a series of circular buffers. This is a very useful command if you are debugging.
Example:
  • adb logcat [option] [filter-specs]
  • adb logcat -c clears the entire log and exits.
  • adb logcat -d > Name_of_Log_File.txt prints the log in a text file
11. Sideload
Command:
adb sideload <update.zip>
This is by far the most impotent and useful adb command. It lets you flash rom and zip files via fastboot mode.


12. Forward socket connections
Command:
adb forward <local> <remote>
This command is used to forward socket connections. forward specs are one of: tcp:<port>
Example:
  • localabstract:<unix domain socket name>
  • localreserved:<unix domain socket name>.
  • localfilesystem:<unix domain socket name>
  • dev:<character device name>
  • jdwp:<process pid> (remote only)

13. Wait until device is connected
Command:
adb wait-for-device
This command stops all operations until the device is connected. As soon as ypu connect the device it executes the commands.


14. Run/Start Server
Command:
adb start-server
This command makes sure that there is a server running.


15. Kill/Stop Server
Command:
adb kill-server
This command kill the server if it is running


16. View Device status on Console
Command:
adb status-window
This command continuously print device status for a specified device.


17. ADB Reboot Command 
Command:
adb reboot [bootloader|recovery]
If you want to reboot device/recovery ar bootloader than this command reboots the device, optionally into the bootloader or recovery program.
Example:
  • adb reboot 
  • adb reboot recovery
  • adb reboot-bootloader

18. Start ABD with root permisions
Command:
adb root
If you want to have root privileges for ADB this command restarts the adbd daemon with root permissions


19. ADB usb listen
Command:
adb usb
This command restarts the adbd daemon listening on USB. and as soon as you connect the device with usb it detects it.


20. ADB tcpip listen
Command:
adb tcpip <port>
Restarts the adbd daemon listening on TCP on the specified port.

Fastboot Commands

21. Flash update.zip with Fastboot
Command:
fastboot update <filename>
If you have a update.zip and you want to flash it via Fastboot mode. Than this command comes handy.


22. Flash partition with Fastboot
Command:
fastboot flash <partition> <filename>
If you want to flash a specific partition like recovery or kernel.
Example:

  • fastboot flash recovery TWRP-recovery.img   -  flash recovery image where (recovery is partition name) and (TWRP-recovery.img is filename)
23. Erase a partition from the device
Command:
fastboot erase <partition>

Caution
This command will erase a partition from your device completely. You might want to be very care full while using this command. because the partition will be deleted from the storage if you accidentally erase the system partition your device will not boot. you will have to recreate the system partition again to flash another rom. So run this command only if you know what you are doing.
Example:
  • fastboot erase system  -  erase system partition
  • fastboot erase recovery   -  erase recovery partition

Conclusion
These were the ADB commands that you will ever want to know. Just having knowledge of some of the commands given above would prove to be really beneficial to you in the future. As if you ever wish to reboot your device into a specific mode or just want to install an app right off your computer, you will be able to do so by just issuing a single line of command from the Command Prompt Window.

Remember Some of the above commends could be dangerous for your device and might hard brick your device. So proceed with caution and run only the commands you are sure with.

0 comments:

Disable_Adblock

We know Ads suck, but at IrisBuddies we will not let them do that
As blocking is a good idea to get rid of stupid “Download Now” Buttons around the web
That’s not in our case. We think you won't find Ads on Our site terrible or annoying
Support us by Whitelisting “IrisBuddies” on your Adblocking Plugin or By disabling your AdBlocking software

If you think this is not good and we should allow AdBlocking Plugins
then Please Contact Us or write us on our Facebook Page
and we might allow it in near future.