How to use ADB and Fastboot Commands: As many people don’t know ” What are ADB Commands & Fastboot command and How to use them??” So in today’s article, I’m going to explain about best useful ADB commands and Fastboot commands and how to use them. Just relax and stay tuned to the article.
Actually, besides a normal booting of an Android device, there are 2 more modes of system maintenance in android devices. They are as follows:
- Bootloader (or) Fastboot Mode and
- Recovery Mode.
We can proceed into both the modes by using startup keys as well as by using the ADB commands.
Below they s an infographic of the complete process. Just have a look at that infographic.
What is a Bootloader??
A Bootloader is a computer program which loads the operating system or a runtime environment for the computer after the completion of the self-testing.
What is an Android Recovery mode??
Every Android device comes with a Google recovery environment, and that is known as “stock recovery.” Every individual device has their own specify buttons to enter into the boot mode, or you can use the ADB commands on your Android devices to enter into recovery mode.
|ADB & Fastboot Commands and their Uses are as Follows|
|Commands||Use of the Commands|
|Basic ADB Commands|
|adb reboot||perform a reboot|
|adb reboot download||reboots the device into download mode ( Mainly for LG and Samsung Galaxy Devices)|
|adb reboot recovery||reboots into recovery [stock or TWRP whichever is installed]|
|adb reboot fastboot||Reboots a connected device into Fastboot mode.|
|adb reboot bootloader||reboot into bootloader or fastboot menu|
|adb reboot sideload||reboots the device into sideloading menu|
|adb devices||list all connected devices|
|Installing/Updating and Uninstalling Apps using ADB Commands|
|adb install <Applicationpathpackagename>.apk||ADB install command, let’s you install APK files directly to phone. To use this command type adb install application path, as shown in the commands part. Now hit enter key and it will start installing the app on your phone. e.g adb install C:/Users/Mahesh/Downloads/Supermario.apk. If process succeeds it will show you “Success” in the command window.|
|adb unistall package_namee.g
adb uninstall com.android.chrome
|This command is used to Uninstalls an application from your device. The easiest way to find a package name is, install Package Name Viewer from the play store and find the name of the package under the App Name. If process succeeds it will show you “Success” in the command window.|
|adb install -r <Applicationpathpackagename>.apk||This command is used to update the app which is already installed.|
|adb uninstall -K package_namee.g
adb uninstall -K com.android.chrome
|This Command is used to Uninstall an app but keeps it’s data and cache directories. If process succeeds it will show you “Success” in the command window.|
|adb shell||starts the background terminal.|
|adb shell e.g adb shell su||switches to the root of your phone. Please make sure that you’re rooted in case you wish to use adb,shell su.|
|exit||exits the background terminal.|
|Backing up system and installed apps.|
|Create a folder Backup and under the backup folder and Create two folders named SystemApps and InstalledApps in your adb folder. Before doing this. These folders are necessary as you’ll be pushing the backed up apps to these folders.|
|adb pull /system/app backup/systemapps||backs up all the system apps of your phone to the SystemApps folder that you created in the ADB folder.|
|adb pull /system/app backup/installedapps||backs up all the installed apps of your phone to the installedapps folder that you created in the ADB folder.|
|Push and Pull files|
|adb rootadb push >e.gadb push
adb push filepathonPC/filename.extension
|This adb push commands let’s you transfer any files to your phone from your PC. You simply need to provide the path of file on your PC and path where to place this file on your phone.|
|adb rootadb pull>e.gadb,pull systemmediaSong.mp
adb pull [Path of file on phone],[Path on PC where to place the file]
|Same as the adb push command. Using adb pull, you can simply pull any files from your phone.|
|To flash files using fastboot, place the desired files in Fastboot folder or Platform-tools folder that you obtained after installation of Android SDK tools.|
|Fastboot Flash File.zip||Flashes a .zip file to your phone, when your phone is connected in Fastboot mode.|
|Fastboot Flash recovery recoveryname.img||Flashes a recovery to your phone when it’s connected in Fastboot mode.|
|Fastboot flash boot bootname.img||Flashes a boot or kernel image when your phone is connected in Fastboot mode.|
|Fastboot getvar cid||shows you the CID of your phone.|
|Fastboot oem writeCID xxxxx||writes the super CID.|
|fastboot erase system
fastboot erase data
fastboot erase cache
|In case you want to restore a nandroid backup, you’ll have to delete the current system/data/cache of your phone first. Before doing this, it is always recommended to have backed up your system using a custom recovery>backup option and copy the backed up .img files to Fastboot or Platform-tools folder in Android SDK folder. Then performing these commands will erase everything.|
|fastboot flash system system.img
fastboot flash data data.img
fastboot flash cache cache.img
|These commands will restore the backup that you made using a custom recovery on your phone and placed in the Fastboot folder under Android SDK tools.|
|fastboot oem get_identifier_token
fastboot oem flash Unlock_code.bin
fastboot oem lock
|These commands help you to get the identifier token of your phone that can be used for unlocking the bootloader. The second command helps your to flash the bootloader unlock code, and the 3rd commands helps you to lock your phone’s bootloader once again if locking it is actually allowed.|
|adb logcat||Shows you the real time logs of your phone, these logs represent the ongoing process on your device.It is recommended that you run this command while your device boots up to check what’s going on.|
|adb logcat > logcat.txt||Creates a .txt file containing the logs in the Platform-tools folder or Fastboot folder in Android SDK tools directory.|
So these are the best mostly used ADB and Fastboot commands. Before using them completely read the use of command and use them. Hope you would be liked it.
These are the commands for now. We know we have missed lots of commands. We have only mentioned the useful and mostly used commands to make your task easier. If you face any problem or if you need any more commands just leave a message from the below comment box. We will respond as soon as possible. Like us and keep visiting Basictricks.