ADB and Fastboot Command List

1,162

ADB and Fastboot Command List – Here’s a list of some ADB and Fastboot commands that might come in handy in different situations. These ADB commands and ADB Shell commands work on all Android devices regardless of device model or manufacturer.

People who are used to rooting their Android device or customizing it will know ADB and fastboot. This is a system utility that provides access to the Android backend when connected to a PC. It is also one of the constants in the Android ecosystem.

The same command will produce the same results regardless of the device you have, in most cases. ADB or Android Debug Bridge can be used when the Android device is powered on while Fastboot can be used when the device is in Bootloader or Fastboot mode. Now we will take a look at some ADB and Fastboot commands that can be used.

Requirements

Before you can use ADB and Fastboot commands, you must enable USB Debugging on your Android device. This option is found in Developer options but if you don’t know how to do it, you can follow the tutorial on the link below. Apart from that, you will also need ADB and Fastboot drivers on your Windows, Mac, or Linux computer.

ADB Command List

As previously mentioned, ADB commands are used when the device is powered on and you have access to the device. This means that you can unlock the device and grant ADB debugging permissions to the computer.

Listed below are some of the most common and useful ADB commands you might need.

adb help

Displays help documentation on ADB commands.

adb devices

Shows all devices connected to ADB. Can be used to make sure your device is properly connected before performing other operations.

adb reboot

ADB can be used to reboot the device, useful when your hardware buttons are not working or if you are already using ADB. You can also reboot directly into recovery or bootloader using this command.

adb reboot bootloader

Reboot the device into Fastboot or Bootloader mode.

adb reboot recovery

Reboot the device into recovery mode.

adb install

Can be used to install APK files on Android devices from your computer. This is better than the alternative, which is to transfer the APK to the device and then install it. This command is generally used by developers. Please note that you must copy the APK file to install in the ‘platform-tools’ folder, otherwise you must also type the APK location.

adb install OPLiveWallpapers.apk

Use the following commands to reinstall or update existing apps on your device.

adb install -r OPLiveWallpapers.apk

If the app (APK) you installed supports the move to SD card feature, you can install it to SD storage using the following command.

adb install -s OPLiveWallpapers.apk

adb uninstall

This command can be used to remove an installed application, it is self explanatory from the command itself.

adb uninstall com.facebook.katana

Use the following command if you want to uninstall the application package but keep the data and cache directory.

adb uninstall -k com.facebook.katana

Keep data and cache directories around after package removal.

adb logcat

Displays log data to the screen.

adb bugreport

Displays dumpsys, dumpstate, and logcat data on the screen.

adb jdwp

List of JDWP (Java Debug Wire Protocol) processes on the device.

adb get-serialno

Returns the serial number string of the adb instance with the device.

adb get-state

Shows device status.

adb wait-for-device

This command is used to program a delay before the next command is issued. It runs when the device is online but can be programmed to wait until another process is complete.

adb start-server

Start the adb server process.

adb kill-server

Stops the adb server process (adb.exe terminal process).

adb sideload

Just like you can flash a zip package from a custom recovery, you can also do it via adb sideload, as long as the recovery supports it. TWRP Recovery which is the most common custom recovery which all devices support. This way you can flash packages directly from your computer without having to first transfer them to your phone or any external storage.

In order to sideload the mod or update.zip file successfully, you must first copy it to the SDK folder.

adb sideload sample.zip

adb pull

This command can be used to pull any file from the device and save it on your computer. To download or drag files from an Android device to the platform-tools SDK directory, use the following command:

adb pull /sdcard/screenrecord.mp4

If you want to download files from your phone storage to a specific drive on your computer, run the following command

adb pull /sdcard/screenrecord.mp4 e:\

adb push

Similarly, this command can be used to move files from computer to phone. If the file to be moved is stored in the SDK folder, use the command

adb push OPLiveWallpapers.apk /sdcard

To save or send files to Android from a specific drive on your computer, use

adb push e:\OPLiveWallpapers.apk /sdcard

Having mentioned the list of ADB commands above, let’s check the list of ADB Shell commands below.

ADB Shell Command List

Below is a list of some very useful ADB shell commands.

adb shell

This command starts the remote shell command console on the device and lets you control the device.

adb shell pm uninstall -k –user 0

You can uninstall system apps installed on Android devices. This is the easiest way to uninstall bloatware. Just use the following command followed by the package name of the application.

pm uninstall -k --user 0 com.facebook.katana

adb shell dumpsys

You can use this ADB shell command to dump all system data about hardware and software configuration.

adb shell dumpsys

You can also use it to get information about device-specific components, such as display, battery, etc.

adb shell dumpsys display
adb shell dumpsys battery
adb shell dumpsys batterystats

adb shell wm density

This command allows you to change the pixel density of your Android device’s display without any hassle. To change the screen resolution of the phone, you must know the native resolution. If you don’t know, run the following command:

adb shell dumpsys display

Running the above command for Galaxy S9+ gave me the following info about the screen resolution and density of the S9+ phone.

mDisplayInfos=PhysicalDisplayInfo{1440 x 2960, 60.000004 fps, density 3.5, 530.086 x 529.464 dpi

Now, if I want to set a lower resolution for the Galaxy S9+, I will use the following command. This value may vary per phone, you’ll know it’s true when you can read the text and the app doesn’t make the value too small from 120 to 640.

For 1080p (FHD)

adb shell wm size 1080x2220
adb shell wm density 480

For 720p (HD)

adb shell wm size 720x1560
adb shell wm density 350

adb shell pm list packages

The following command prints the names of all application packages installed on the phone. You can add additional conditions or filters to list only certain packages.

To list all packages:

adb shell pm list packages

To get a list of only system packages

adb shell pm list packages -s

To list only third party plans

adb shell pm list packages -3

Only to show disabled app packages:

adb shell pm list packages -d

Only for displaying activated application packages

adb shell pm list packages -e

For a list of uninstalled application packages with installed page.

adb shell pm list packages -u

adb shell screencap

Using the following ADB shell command, you can capture a screenshot of the phone display and then download the captured screen to your computer.

adb shell screencap /sdcard/screenshot.png
adb pull /sdcard/screenshot.png

adb shell screenrecord

On Android devices running Android 4.4 KitKat and above, you can even record your phone or tablet screen and download recorded videos to your computer using ADB shell commands.

Apart from that, you can also set conditions like video duration, pixel resolution and video bitrate, etc. You need to press Ctrl + C to stop recording manually.

adb shell screenrecord /sdcard/screenrecord.mp4
adb pull screenrecord /sdcard/screenrecord.mp4

Use the following command to set the width x height of the video:

adb shell screenrecord --size 1920x1080 /sdcard/screenrecord.mp4

By default, the Android screen recorder duration is set to 180 seconds (3 minutes). You can reduce this timeout as needed (180 seconds is the maximum).

adb shell screenrecord --time-limit 120 /sdcard/screenrecord.mp4

Similarly, you can also specify the bitrate of the video output. To set the bitrate to 4MBps, for example, you can use the following values:

adb shell screenrecord --bit-rate 4000000 /sdcard/screenrecord.mp4

adb shell cd

Change ADB shell directory using ‘cd <directory>’

adb shell
(Hit Enter then the following command)
cd /system

adb shell rm

Using this ADB shell command, you can delete any file or directory from Android device.

To do that, you have to type the command ‘adb shell’ first and press Enter key. After that, you can use any of the following commands followed by the file or directory name as shown below.

Delete files:

rm -f /sdcard/OPWallpaperResources.apk

Delete directory or folder:

rm -d /sdcard/ZooperWidget

You can also use ‘rmdir’ instead of ‘rm -d’ to delete directories.

adb shell mkdir

This ADB shell command is used to create a new directory or directories under an existing directory. You can also set permissions for the directory. Run ‘adb shell’ then the following command:

mkdir /sdcard/NewFolder
mkdir -m 644 /sdcard/NewFolder
mkdir -p /sdcard/NewFolder/Folder1

adb shell cp & adb shell mv

You can use these commands to copy, move, and rename files and directories. Again, you have to start with the ‘adb shell’ command first.

To copy a file and then paste it, specifying the source and destination location as shown below:

cp /sdcard/OPWallpaperResources.apk /sdcard/LiveWallpapers

To move files from one location to another, type the following command specifying the source and destination locations:

mv /sdcard/OPWallpaperResources.apk /system/app

If you want to move the file to another location with a new name.

mv /sdcard/OPWallpaperResources.apk /sdcard/OPLiveWallpapers.apk

adb shell netstat

To check the network statistics of an Android device, run the command and type ‘adb shell’:

netstat

adb shell ip

Using this command, you can see, the Wi-Fi IP address of the phone. Run ‘adb shell’ in the command window and then run the following command:

ip -f inet addr show wlan0

adb shell top

If you want to know about the top CPU processes running on an Android device, you can use the following command after running ‘adb shell’:

top

If you want to stop the CPU monitor process, press Ctrl + C on the keyboard.

adb shell getprop & adb shell setprop

Using the above command, you can not only get properties from Android’s build.prop configuration, but can also set property tag values on build.prop. See the example below:

Type ‘adb shell’ in the cmd window, press Enter key and then run the following command:

getprop

Here are some more examples:

getprop ro.build.version.sdk
getprop ro.chipname

Now, to set the value of a specific build.prop property, you can use the ‘adb shell setprop’ command. See the example below:

setprop net.dns1 1.2.3.4
setprop net.dns2 1.2.3.5

Similarly, you can also set a custom VMHeap size:

setprop dalvik.vm.heapsize 40m

Fastboot Command List

This command can only be used when the device is in Fastboot mode. You can try a key combination to put the device into this mode or use the ADB commands mentioned above.

adb reboot bootloader

Once in Fastboot mode, you can use a number of Fastboot commands as mentioned below.

fastboot devices

Shows all connected devices. Can be used the same as the ‘adb devices’ command to ensure devices are properly connected.

fastboot oem unlock

Unlock the bootloader on some Android devices like Pixel or OnePlus. Most other Android devices require you to get an unlock key from the OEM.

fastboot oem lock

Used to re-lock the device’s bootloader.

fastboot reboot bootloader

Reboot the device from fastboot mode back to fastboot mode. Sometimes this may be necessary when you are flashing something in fastboot mode.

fastboot flash

This command can be used to flash something to the device. This can be a zip file, boot image or recovery image.

fastboot flash boot boot_image.img

Flash the boot image to your device.

fastboot flash recovery recovery_image.img

Flash the recovery image to your device.

fastboot boot image_file.img

This command can be used to boot the device using a specific image file without having to flash it first. Can be useful for testing images before flashing them.

So, this is all about useful ADB and Fastboot commands that can help Android users do a huge number of things. If you have any questions about the Fastboot command, let us know.

You might also like
Leave A Reply

Your email address will not be published.