Top 21 ADB commands Android users should know
In fact, most advanced tutorials and how-to guides on Android tend to use adb commands to get the job done.
Furthermore, adb is also very useful when the Android device is not working as it should or when things become very messy and unusable. Although it looks a bit 'scary' and complicated, here is a list of adb commands to get started and do some useful things in the pipeline.
Install ADB on Windows
Unlike in previous versions, users do not have to install the complete Android SDK to install ADB. Just download the standalone ADB zip file, extract it to the root of your C drive and everything is done. To access adb, open Command Prompt by searching for it in the Start menu and navigate to the adb folder using the command below. If adb is installed in another directory, change the command accordingly.
cd c:adb
Tip: Then, open a Command Prompt from the same folder, press and hold the Shift key, then right-click on the folder, then click on the ' Open command prompt here ' option.
Now, connect the Android device via USB and test the commands below.
Commonly used ADB commands
1. Start or stop the ADB server
Obviously, the first command one should know is how to start and stop the adb server. This allows users to interact with the connected Android device. To start adb server, use the command below.
adb start-server
Once the user has completed his work, he can use the command below to stop the adb server.
adb kill-server
2. List connected Android devices
This is one of the most popular commands. When connecting a device to a computer via USB, use this command to verify if adb can find the connected device.
adb devices
If the device is properly connected to the system, the above command will start the service daemon, scan the system and list all connected Android drives. The best thing about this command is that it lists both the status of the devices and their serial numbers.
3. Know the status of the device
As its name suggests, this command can be used to know the device status. When the command is executed, it will display whether the device status is offline, bootloader or device. For a normal Android device, users will see their Android status as 'device', like in the image below.
adb get-state
4. Displays the device serial number
This command tells the user the serial number of the connected device. On a phone or tablet, users can see their device's serial number by navigating to ' Settings > About Phone > Status '.
adb get-serialno
5. Copy files from computer to phone
If you want to copy files from your computer to your phone using adb, you can use this command. Don't forget to replace [source] and [destination] with the actual file path.
adb push [source] [destination]
When replacing the above command with the actual file path, it will look like this.
adb push "E:Video SongsAankhon Mein Teri - Om Shanti Om.mp4" "/sdcard/Downloads/video.mp4"
6. Copy files from phone to computer
Just like when copying files from computer to Android device, users can also copy files from phone to computer. To do that, just use the command below. Replace [source] and [destination] with the actual file path.
adb pull [source] [destination]
When replacing the above command with the actual file path, the command will look like this.
adb pull "/sdcard/Downloads/video.mp4" D:Downloads
7. Install/Uninstall the application
In addition to moving files back and forth between computer and phone, users can actually install the apk file with just a single command. To install an application, the user must specify the full path of the apk file. So, replace 'path/to/file.apk' with the actual apk file path.
adb install "path/to/file.apk"
If there are multiple devices attached to the computer and you only want to install the apk file on a single device, use the command below. Replace [serial-number] with the actual device serial number. Users can get the device serial number using the fourth command above.
adb -s [serial-number] install "path/to/file.apk"
To uninstall an app, simply execute the command below. Replace with the app's actual fully qualified package name.
adb uninstall
8. Backup Android device
To backup all device and app data, users can use the command below. When executed, it will enable the backup feature, ask the user to accept the action on the Android device and then create a 'backup.adb' file in the current directory.
adb backup -all
9. Restore Android device
To restore a backup, use the command below. Don't forget to replace 'path/to/backup.adb' with the actual file path.
adb restore "path/to/backup.adb"
10. Restart your Android device into Recovery mode
Recovery mode helps users repair or restore Android devices using the tools built into it. In general, users can boot into Recovery mode by using a combination of volume and power buttons. Additionally, users can also connect the device to the system and use the command below to boot into Recovery mode.
adb reboot-recovery
11. Restart your Android device into Bootloader mode
The command below allows users to boot into bootloader mode. In general, bootloader mode is very similar to fastboot mode.
adb reboot-bootloader
12. Restart your Android device into Fastboot mode
Fastboot mode is often used to flash custom ROMs, bootloaders, and even kernels. Use the command below to boot into fastboot mode.
adb fastboot
13. Start a remote shell
This command starts a remote shell, as well as allows the user to control and configure the device using shell commands.
adb shell
14. Take screenshots
There's nothing difficult about taking screenshots on Android. All you have to do is press the power button and volume down button at the same time. Additionally, users can also use this command to take quick screenshots. Replace '/path/to/screenshot.png' with the actual destination path. If desired, users can customize the file name by changing ' screenshot' to any desired name.
adb shell screencap -p "/path/to/screenshot.png"
When replacing the destination path, the command will look like this.
adb shell screencap -p "/sdcard/screenshot.png"
15. Record Android screen
In addition to taking screenshots, users can also record Android device screens using the command below. Again, replace '/path/to/record.mp4' with an actual destination path. Of course, users can customize the file name by changing 'record' to any desired name.
adb shell screenrecord "/path/to/record.mp4"
16. Restart ADB in USB mode
If the ADB server has been started and for some reason the commands still don't work. You can try restarting ADB on USB. There is no independent ADB restart command. But the following command will reestablish the ADB connection over USB. This will cause the ADB server to restart.
adb usb
17. ADB version
This is a very handy command as very few commands work with the latest ADB versions. For example, older versions of ADB do not allow you to run the flashall command. So when you get a command error, the first step is to check the adb version. You can then verify if the command is supported in that version. Following is the command to check adb version.
adb version
18. Connect to ADB via WiFi
In recent versions of ADB, you can connect directly to any Android device over WiFi. All you have to do is enable USB debugging on the other device and run the following command.
adb connect địa-chỉ-ip
So the command will look like this:
adb connect 192.168.1.104
19. List files
To copy or send files, you need to know the exact location of the folder. Usually, the phone's internal memory is named sdcard. So all the folders inside the phone are in the /sdcard folder. However, if you want to know the exact location or locate a specific file, you can use the 'ls' command. The ls command lists files in the directory.
adb shell ls "directory_name"
20. List all installed packages
Now, uninstalling packages will require you to get the correct package name. The actual package name is different from the installed application name. So below is the adb command that lists all installed packages.
adb shell pm list packages
Now, the resulting output is quite large. So if you want to list a specific application package, you can try filtering by application name. For example, if you want to search the package name for FDroid, use the following command.
adb shell pm list packages | findstr "fdroid"
21. List connected Fastboot devices
This is one of the lesser known commands. When you boot the device in Fastboot mode, to check if the device is connected or not, you can use the following command.
fastboot devices
Those are all the basic commands TipsMake.com wants to share with readers. If you want to share your thoughts and experiences about using adb commands on Android devices, leave your comments in the comments section below!
Good luck!
You should read it
- Android SDK - Download Latest Android SDK
- How is Android One and Android Go different?
- All you need to know about Android Pie
- What is Android TV Box?
- 3 newly changed settings of Android P
- What else do you not know about Android TV?
- Learn new features of Android Q (Android 10)
- Android Q will be called simply Android 10
- Features Android 11 R has known so far
- The best top 7 Android TV box
- What is Android ROM? Three things to know about Android ROM
- Is it true that Android costs more RAM than iOS?
Maybe you are interested
BadBox Malware Is Picking Up Speed, Targeting Certain Android Devices
How to Uninstall Any Android App Using ADB (Including System Apps and Bloatware)
How to fix Android not connecting to Windows via ADB
How to use ADB and Fastboot on Android
How to Hack Broadband and Increase Network Speed
How to Turn Off Adblock