ADB & Fastboot commands are probably the most powerful commands for Android phones. ADB Fastboot commands used to control and change anything on any Android phone. If you like customization and rooting, then you must have heard of ADB & Fastboot commands, and maybe you already performed some commands for modification purposes. But there are many commands that you possibly unaware of, and so we are going to list those commands in this guide. Here you will know 50+ ADB Fastboot Commands on Android to perform through Windows, Mac, and Linux.
If you are a basic Android user and unaware of features like developer options, then you are missing many advanced features that you can get on your Android phone. As I mentioned earlier that these are powerful commands that can be used to fix, upgrade, or even unlock Android devices. Out of ADB and Fastboot, ADB is a common word, and you might also know about this word and its use. And if not, don’t worry, I will help you to understand both ADB and Fastboot in this guide along with ADB and Fastboot commands.
What is ADB?
The expansion of ADB is Android Debug Bridge, and it is used to communicate with Android devices through various commands. These commands that we use to communicate between devices are known as ADB commands. ADB feature comes by default in all Android phones but hidden deep in Settings. To use ADB commands, we need to first enable ADB support from Settings on the device. The ADB works as a client-server structure for easy communication.
What is Fastboot?
Fastboot is a bootloader mode or diagnostic tool on Android phones, which we can use to flash different files on the phone. It is a unique boot state which only supports the command line interface including reboot or restart operation. The Fastboot mode is used for any kind of modification on Android phones using Fastboot commands.
Now you must be familiar with the term ADB & Fastboot and how does it work. But still, one question remains that where we will be using these ADB & Fastboot commands. And so, we have a dedicated section below for the same. Let’s check out the usage of these commands.
What are ADB and Fastboot Commands?
ADB & Fastboot commands have different functions and effects on Android phones. Let’s first understand ADB Commands. These commands are used to communicate with devices like booting devices into different modes, installing & uninstalling Apps, and also checking connectivity.
Fastboot commands are used to add additional functionality or features to devices. These features include flashing various files like custom recovery, Magisk, and other image files. Fastboot commands work only when the device is in the specific bootloader state.
Note:- To use ADB & Fastboot commands, the device should be connected to the computer. And also, drivers are required. So before using ADB & Fastboot commands, make sure to install ADB & Fastboot drivers on your computer. The driver may not be necessary in the case of the Mac and Linux operating systems, so you can skip installing the driver. For Mac and Linux you can use Platform tools.
Important tools for ADB & Fastboot:
- Install ADB & Fastboot Driver – (Windows)
- Platform Tools for Windows (v31.0.2)
- Platform Tools for Mac (v31.0.2)
- Platform Tools for Linux (v31.0.2)
Also, for using ADB commands, the USB debugging must be enabled on your phone. So let first check out the method to enable USB debugging.
How to Enable USB Debugging on Android Phones
- First, open Settings on your Android phone.
- In Settings, look for About phone and open it. It can be inside some different settings in different brand devices. So searching About Phone is a good move.
- Now, in the About Phone, repeatedly click about 7-8 times on the Build Number. It should display, ‘Now you are a Developer.’
- Go back to the main Settings and search for ‘Developer Options.’
- Open the Developer Options from the search results and search for USB debugging.
- Enable the USB Debugging Option.
- That’s all, and now you can connect your phone to the computer and use ADB commands.
Now you can easily use ADB commands. But for Fastboot Commands first, you have to boot your phone into Bootloader mode/Fastboot mode. You can use the key combination to boot your phone into this state. The key combination can vary according to the device you are using. There is also a common method to boot any phone into Bootloader, which is possible using ADB Command that you will know in the below list of ADB Fastboot Commands.
ADB Commands for Windows, Mac, & Linux
- adb devices – This is the basic adb command that used to list all the devices connected to the computer, and debugging is enabled. If you are entering the ADB command for the first time, then it will prompt to allow debugging on your phone. So you must allow it to use ADB commands to your phone.
- adb reboot – You can use this command to reboot your phone without using the power button. It can be used when any modification requires a reboot.
- adb reboot bootloader – As you know, to use fastboot commands, you have to boot your device into bootloader/fastboot/download mode. So this is the command that will boot your device into the Fastboot mode. After this adb command, you can use any fastboot command to modify your device.
- adb reboot recovery – With this command, you can boot your Android phone to the stock recovery or custom recovery. You can also boot your phone into recovery using key combinations, but that is more complicated as the combination varies as per devices.
- adb shell – The shell command will enable the Linux terminal interface on your command window to control your connected Android phone. It allows us to enter Linux commands to interact with the device.
- adb install <file path> – This command is for installing apps on the phone directly through the computer. Here <file path> means the location and name of the APK. So after adb install, just drag and drop the apk file, and it will pick the location and file name.
- adb install -t <file path> – Just like the above command, you can use this ADB command to install an app to the phone but for testing only.
- adb install -r <file path> – If you want to reinstall any existing apps on your phone, then insert -r in the normal install command.
- adb install -f <file path> – It will install the app to the internal storage of the phone.
- adb shell pm uninstall com.example.myapp – This is the adb command for uninstalling any existing apps on your phone. Here com.example.myapp refers to the package name of the app that you want to uninstall. So make sure to replace com.example.myapp with the correct package name. This is a helpful command if you want to remove bloatware or pre-installed apps.
- adb shell pm uninstall com.example.myapp – To uninstall any app while keeping its data and cache in the storage.
- adb clear com.example.myapp – It will remove all the data and cache related to the package.
- adb shell screencap <screenshot location> – If you want to take a screenshot of the current screen of your phone, then you can use this ADB command. Replace the <screenshot location> with the location and file name where you want to save your screenshot like /sdcard/screenshot.png.
- adb shell screenrecord <screenrecord location> – Similar to the screenshot, you can also record the screen of the phone with ADB command. Make sure to replace <screenrecord location> with the location & extension where you want to save the screen recording file. For eg. /storage/emulated/0/Download/screenrecord.mp4. To stop screen recording, press Ctrl+C.
- adb push <file source> <file destination> – The adb command used to copy the <file source> from your computer to the <file destination> on your phone. It can be used if you want to transfer any file from the phone without drag and drop. Replace <file source> with file directory where your file is existing and <file destination> with the location where you want to save the file.
- adb pull <source> <destination> – It is the same command as adb push but to copy files from phone to computer.
- adb logcat – You can use this command to display the real-time log of your phone.
- adb logcat > logcat.txt – To save the captured real time log to file logcat.txt.
- adb remount – If the system partition of your phone is set to Read-Only, but you want to mount it as Read/Write, then this adb command can be used.
- adb sideload <file> – This adb command used to sideload any file to the device. The file name must be complete with its extension.
- adb kill-server – The command used to kill the adb process.
- adb start-server – To restart the adb server after killing the process with the above command.
- adb connect <device IP address> – To connect the phone with WiFi along with Debugging access.
- adb forward tcp:7100 tcp:6100 – ADB command to forward the host port from 7100 to 6100. Just replace the port number with another port that applies in your case.
- adb –help – You can use this command to get help related to ADB like some ADB commands, shortcuts, and more.
Fastboot Commands for Windows, Mac & Linux
- fastboot reboot – To reboot your device back into the fastboot/bootloader mode. Remember fastboot command will only work if your phone is in Fastboot mode that can be achieved using adb reboot bootloader command.
- fastboot devices – This fastboot command will list the devices connected to the computer in fastboot mode.
- fastboot reboot recovery – Entering this fastboot command will boot into Stock or custom recovery. We generally use this command after flashing recovery image with fastboot command.
- fastboot oem unlock – The command used to unlock bootloader on Google phones and some other phones. It will only work with supported phones.
- fastboot flashing unlock – This one is also used to unlock bootloader but for different devices like the new Pixel phones released after 2015.
- fastboot flashing unlock_critical – It is also used to unlock bootloader for a different condition like updating bootloader, and updating phones manually.
- fastboot oem lock – Like unlock, you can also use the fastboot command to relock the bootloader of many Android phones.
- fastboot flashing lock – To relock bootloader of newer phones, this fastboot command can be used.
- fastboot flashing lock_critical – It can be used to relock bootloader if you have unlocked using the unlock_critical command.
- fastboot flash boot boot.img – You can use this fastboot command to flash boot image files. It is generally used when the phone is stuck in the boot loop due to a corrupt boot image. And also, the command used to root Android phones after patching the boot image file. Make sure to rename your boot file to boot.img.
- fastboot flash recovery recovery.img – If you want to flash stock recovery or a custom recovery, then this fastboot command is used. Before entering the command, rename the recovery image file to recovery.img.
- fastboot flashall -w – The fastboot command used to wipe the /data partition on the device.
- fastboot oem device-info – This fastboot command will help us to see the bootloader status. It will return ‘True’ if bootloader unlocked and return ‘False’ if bootloader locked.
- fastboot format:ext4 userdata – It can be used to delete/wipe all the data from the ext4 partition. Change the partition if you want to delete data from other partitions.
- fastboot boot recovery.img – You can use this fastboot command to boot the phone into recovery temporarily. Replace the recovery.img with the recovery file name.
- fastboot erase data – If you want to clean flash any ROM then you can use this fastboot command to erase phone data.
- fastboot erase system – To erase the system from your phone before flashing a custom ROM.
- fastboot erase cache – To delete all cache from the phone.
- fastboot erase system -w – This fastboot command will erase System, data, and cache in one command. So it is the combined command for the previous three commands.
- fastboot flash system system.img – You can flash the system image file using the command. The system image can be found in the Firmware of the phone.
- fastboot flash userdata data.img – Similar to the last fastboot command you can also flash user data image.
- fastboot boot kernel ramdisk – For developers who are working on the custom kernel can use the fastboot command to test the kernel.
- fastboot flash zip file.zip – It can be used to flash zip files like custom ROM. Replace the file.zip with the file name you want to flash.
- fastboot getvar mid – This fastboot command used to get the device model number.
- fastboot getvar all – It will give more information about the device like device model, radio, IMEI, etc.
Now you know adb & fastboot commands that you can use to modify and control your phone. As you know these commands require adb & fastboot drivers. But if you don’t have the driver on your computer then you can use the Platform-tools. So, download the Platform tools from the links given above and follow the below guide to open a command window in the same location.
How to Open Command Prompt in Platform Tools
- Extract the downloaded Platform Tools zip file to your computer.
- Go to the extracted folder.
- Now press Shift + Right click in the empty area inside the folder.
- It will open an interactive option, so select ‘Open PowerShell window here’ or ‘Open Command Window here’.
- Now it will open the Command prompt/PowerShell window where you can enter any ADB & Fastboot commands.
So there you have it the complete list of ADB & Fastboot commands for Windows, Mac, & Linux operating system. There are more ADB Fastboot commands that generally used by recognized developers for development and testing purposes. In case if you have any queries or any problem with the given ADB Fastboot commands then let us know in the comment section.