Table of all ADB & Fastboot Commands for Android (Windows / Mac / Linux)

0
Share

In this article, you will find a list of all ADB and Fastboot commands for Android devices. You can execute these commands on any computer regardless of its operating system (Windows, Mac, or Linux). Commands are universal, which means that the same commands will work on any Android device, regardless of manufacturer or device type.

Android enthusiasts who are familiar with unlocking, rooting, or installing a custom recovery on their devices should be familiar with ADB and Fastboot. These are system utilities that provide the backend of Android when connected to a computer.

ADB or Android Debug Bridge can be used when an Android phone is connected to a PC in fast boot or bootloader mode. There are certain codes that can be executed using a computer to perform a function on Android devices. Most people use Fastboot to unlock the phone’s bootloader. Occasionally, you may need to unlock the device (in the case of hard bricks) using Fastboot.

Most fastboot and ADB commands return the same results on any device, regardless of manufacturer or variant. If you are stuck somewhere, where you need fastboot / adb command for help, then this post is for you. I’ve listed all the important fastboot, and ADB commands in the table below. The codes, along with their features and functions, are also properly mentioned. Use Ctrl + F to find out what you need.

Pre-requisite

Before going to the fastboot & ADB commands, you need certain tools and settings to be enabled on your device as well as the computer. Otherwise, you can not make use of the fastboot or ADB commands. The tools are needed to be installed on the computer. On the other hand, the necessary settings are to be made on the phone.

Methods are the same for all Android smartphones. So, don’t worry about the OEM or variant. Consider the following checkpoints:

  1. You need to enable USB Debugging mode to connect your Android phone to computer. (Settings > About Phone > Build number > Tap it 7 times to become developer; Settings > Developer Options > USB Debugging).
  2. Download Android SDK Platform Tools (ADB & Fastboot)
  3. Mac users: Setup ADB on Mac (using Homebrew)
  4. USB Cable: Preferably, the one provided by the manufacturer.
  5. Optional: Download & Install Android USB Driver on your computer.

ADB Commands list

Here is the complete list of all the ADB commands that you can execute using the command prompt or terminal while connecting the Android device to the PC with all required settings. Perform the following if you had fulfilled the prerequisites mentioned above:

ADB devices

Push and Pull files using ADB

Push and pulls are used to transfer any files from the device to the computer or vice versa. To pull a file from the Android device to the computer, you need to provide the full path of the file. You can use the following ADB command:

adb pull </path/filename>

You need to change the file name with an extension. For example, we are pulling a file called “CartoonHD.apk“. You need to execute the command in the following way:

adb pull /system/app/CartoonHD.apk

On the other hand, while pushing files from computer to Android using ADB, you can execute the following command:

adb push <source-path> <target-path>

Same as before, you need to provide the full path with extension and the destination path as well. Check out the example below:

adb push /local/path/CartoonHD.apk /sdcard/apps/

ADB Shell Commands list

Here is the complete list of all the ADB Shell commands that you can execute using the command prompt or terminal while connecting the Android device to the PC with all required settings.

ADB Shell CommandsFunctions
adb shellStarts the remote shell command console in the device and lets you control the Android through it
adb shell wm densityUse it to change the pixel density of your Android device (details given below)
adb shell pm list packagesShows all the installed apps package name on your Android
adb shell pm list packages -sShows the list of all the system apps installed on your Android with the package name
adb shell pm list packages -3List of all the 3rd party apps installed on your Android
adb shell pm list packages -dDisabled apps list on your Android
adb shell pm list packages -eEnabled (active) apps list on your Android with package names
adb shell pm list packages -uList of all the apps that you uninstalled from your Android with installed pages
adb shell
Hit enter and execute the following:
cd /system
These commands change the directory to /system
adb shell
Hit enter and execute the following:
rm -f /sdcard/whatsapp.apk
Delete a file: replace whatsapp.apk to your desired file name with extension
adb shell
Hit enter and execute the following:
rm -d /sdcard/DCIM
Delate a folder: replace DCIM to your desired folder name
adb shell
Hit enter and execute the following:
mkdir /sdcard/Folder1
Create a new folder “Folder1” under /sdcard
adb shell
Hit enter and execute the following:
netstat
Check the network statics on your Android device using ADB
adb shell
Hit enter and execute the following:
ip -f inet addr show wlan0
Shows the device’s Wi-Fi IP address
adb shell
Hit enter and execute the following:
top
Use this Coe to monitor the running CPU process on your Android device
adb shell
Hit enter and execute the following:
getprop ro.build.version.sdk
Get the property of Android’s build.prop configuration
adb shell
Hit enter and execute the following:
setprop net.dns1 1.2.3.4
Use to set the values of built.prop configuration and change the properties

Uninstall a system app using ADB

If you want to uninstall a system app via ADB Shell command, you can execute the following code:

adb shell pm uninstall -k –user 0 package.name.com

Replace package.name.com with the actual package name that you want to uninstall from your Android system. This method is the easiest way to uninstall bloatware which comes inbuilt with the system that can not be uninstalled generally from the app menu. For example, if Facebook comes as a system app, and you want to remove it, execute the code in the following way:

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

ADB Shell dumpsys command

adb shell dumpsys

Using the dumpsys command, you can gather all the system data about your device’s hardware and software configuration. You can also use it to get information about your Android device’s specific elements, such as the battery, display, and battery stats.

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

Changing the Pixel density using ADB Shell

You can easily change the Pixel density of your Android device’s screen using adb shell wm density commands. In order to do that, you need to know the actual Pixel density of your device. Let’s take an example with the Galaxy S9 Plus. At first, you need to know the original resolution executing the adb shell dumpsys command.

Following are the info about phone’s display, resolution, and density for Galaxy S9 Plus (after executing adb shell wm density):

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

If you want to set a lower resolution, you can check out the following examples (remember, the values may vary from device to device):

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

Depending on your device, you can set the values, whichever looks excellent for you.

ADB Shell command to Send SMS screen

With this ADB command, you can send a text message from your Android phone while connected to the computer:

adb shell am start -a android.intent.action.SENDTO -d sms:CCXXXXXXXXXX --es sms_body "SMS BODY GOES HERE" --ez exit_on_sent true
adb shell input keyevent 22
adb shell input keyevent 66

ADB Shell for screenshots

Using this code, you can capture a screenshot on your Android phone and pull the snapped screen to your computer instantly:

adb shell screencap /sdcard/screenshot.png

Hit enter, and then:

adb pull /sdcard/screenshot.png

Screen recording on Android using ADB Shell command

Android 4.4 Kitkat and above have a shell utility to record the screen and pull the video to the computer. Execute the following commands:

adb shell screenrecord /sdcard/movie.mp4

(Press Ctrl+C or Command+C to stop the recording)

adb pull /sdcard/movie.mp4

By default, the screen recording is limited to 3 minutes only. If you want to set a condition like clip duration, resolution in pixels, and video bitrate, you can use the following commands:

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

I used a 1920x1080p resolution here for an example. You can change the value according to your needs.

Next, use the following command to set the video duration:

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

Similarly, you can also set the bitrate of the video output. For example, I am setting the bitrate to 4MBPS. The code would be as follows:

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

ADB Shell commands for copy, move & paste

Execute the following command to copy and paste files/folders:

adb shell

and then enter the following:

cp /sdcard/The_Shawshank_Redemption.mp4 /sdcard/Movies

(Replace the source file and destination value as per your requirements.)

Next, to move a file or a folder from one location to another, you can execute the following:

mv /sdcard/The_Shawshank_Redemption.mp4 /sdcard/Movies

(Replace the source file and destination value as per your requirements.)

To move a file from one location to another with a new name, use the following:

mv /sdcard/facebook.apk /sdcard/facebook-mod.apk

ADB Shell KeyEvent commands (for advance users)

Using the Shell KeyEvent commands, you can trigger certain functions perform by hardware buttons and UI options on your Android device. Execute these codes only if you know about tweaking VM heap to improve performance.

adb shell input keyevent 3 // Home btn
adb shell input keyevent 4 // Back btn
adb shell input keyevent 5 // Call
adb shell input keyevent 6 // End call
adb shell input keyevent 26 // Turn Android device ON and OFF. It will toggle device to on/off status.
adb shell input keyevent 27 // Camera
adb shell input keyevent 64 // Open browser
adb shell input keyevent 66 // Enter
adb shell input keyevent 67 // Delete (backspace)
adb shell input keyevent 207 // Contacts
adb shell input keyevent 220 / 221 // Brightness down/up
adb shell input keyevent 277 / 278 /279 // Cut/Copy/Paste

Fastboot Commands list

Here is the complete list of all the fastboot commands that you can execute using the command prompt or terminal while connecting the Android device to the PC with all required settings. Perform the following if you had fulfilled the prerequisites mentioned above:

Fastboot device

Anything left?

So, that’s pretty much on our blog for fastboot, and ADB commands. If I missed anything, please do let me know in the comment section below. I hope this post is helpful for you to perform a plethora of commands using cmd or terminal. If you have any questions about ADB or fastboot controls, do let me know by dropping a comment below. I will reply you back as soon as possible.

[su_button url=”https://t.me/getdroidroms” target=”blank” style=”flat” background=”#0064c9″ size=”7″]Join us on telegram[/su_button]