16 Best ADB Commands That You Must Know

adb commands

ADB or Android Debug Bridge is a command-line tool that you can use to access your phone with a computer and perform various tasks. Mostly, developers use ADB for debugging. ADB is also used to root Android, install custom ROM, installing recovery, taking phone backup, etc. There are certain useful ADB Commands that you can use to make things easier.

If a smartphone gets bricked, then the only way to access the files or smartphone itself is to use ADB. Like this, there are many more uses of ADB that make it so special.

In this article, you will find ADB commands that you must know as an Android user. These commands will come useful at times when you are using ADB to access your smartphone.

adb commands

How to Install ADB on Windows

In order to use ADB Commands on your computer, you should have ADB and necessary files installed on your computer. Follow this ADB Installation and Setup Guide to get it installed on your PC.

Once installed, you can start using the commands given below in the ADB shell window.

List of Must Know ADB Commands

Screen Record Android Screen via ADB

Did you know that you can screen record your Android screen using ADB? Use the command below to record the screen for up to 3 minutes. We are using various third-party apps for recording screens, but from now onwards, you can use ADB as well. The only caveat is that you can only record up to 3 minutes. Once started, you can stop the recording before 3 minutes by pressing Ctrl + C.

Command to use: adb shell screenrecord <path>

Take Screenshot with ADB

Similar to Screen Recording, we can also take screenshots using ADB commands. Just execute the command given below to take a screenshot. Make sure to mention the proper path for the image to save.

Command to use: adb shell screencap

Copy Files from Computer to Android Device

The following command can be used to easily transfer files from the computer to your smartphone. It can be any sort of file including videos, APKs, photos, etc.

Command to use: adb push [source] [destination]

Install APK from Computer

For some reason, if you want to sideload APK files to your smartphone via computer, you can use the command given below. Just type the command given below and then replace the path with the location of the APK file.

Command to use: adb install <path>

Access CLI

You can use the below-given command to access the command-line interface or CLI of Android. Every OS comes with a command-line interface and Android is no different. Use the simple command given below to access the same.

Command to use: adb shell

Change DPI of Android Device with ADB

If you want to change the default DPI of your Android device, you can use the below given ADB command. Starting from Android N, it is possible to change the DPI value of Android. Just run the command by mentioning the DPI value and you are done. You have successfully changed the DPI value. Replace xx with DPI value.

Command to use: adb shell wm density xx

Logcat

Logcat basically allows you to take a look at system logs. This will come helpful at situations when you encounter with a bug on any app and more info on the same. Once entered sing the command below, you can use Ctrl + C shortcut to exit.

Command to use: adb logcat

Backup Android Device with ADB Commands

If you want to create a full backup of your Android device, you can use this command. Just type and execute the command. Once done it will create a backup file with .adb extension on the ADB directory.

Command to use: adb backup -all

Restore Android Backup with ADB

You can restore any backups created using the above-given command using the restore ADB command. Execute the command by mentioning the proper path of the .adb backup file and you are done. The restoring process might take some time.

Command to use: adb restore <path>

List Connected Android Devices

After you connect your Android device to the computer, to know whether or not it has been detected, you can use this command. This basically lists all devices connected to the computer along with their serial number as well.

Command to use: adb devices

Check ADB Version

Not sure which version of the software you are running? Using this command, you can check the version of ADB installed on your computer. If it is older, you may download and replace it with a newer version as well.

Command to use: adb version

Connect over WiFi

The newer version of ADB comes with support for WiFi. This means you can connect to an Android device over WiFi. For this, all you have to do is enable USB debugging on the device and run the below given command with proper IP Address. This way you can connect Android to ADB over WiFi.

Command to use: adb connect <ip-address>

Display Serial Number of the Device

If you want to display the serial number of the connected smartphone, you can use this ADB Android Command.

Command to use: adb get-serialno

Check Device Status

This command can be used to check the status of the connected device in ADB. This will help you to find if the device is not responding, etc. After executing the command, the state of the device will be displayed There are three status for the same:

device: Device connected to the ADB server

no device: No device connected or not properly connected

offline: Device connected but not responding.

Command to use: adb get-state

Turn on/off ADB Server

This is the simple command to either turn on or off the ADB server. Use the first command given below to start the server and the second one to stop or turn off the server.

Command to use: adb start-server
adb kill-server

Restart ADB

This command will reestablish the existing USB connection by disconnecting and connecting again. This basically restarts the ADB server.

Command to use: adb usb

Conclusion

These are some ADB commands that you can use for various simple and complex level tasks. There are tons of useful ADB commands that make life easier for you. There are certain actions that would take at least 3 minutes to manually perform, the same task can be done with the help of ADB in less than 10 seconds. Go ahead and explore these cool ADB commands.

Ajay is an active cybersecurity analyst and helps companies find and fix bugs and vulnerabilities. He is an ardent fan and power Linux user. His area of expertise includes Linux and Cybersecurity side of things.