Anshuman Chatterjee | Posted on | 2 min Read

Executing ADB Shell Commands

You can fix the issues in your Android phone by connecting it with your computer and writing some easy commands. For this, you will need some command line tools which you can download from the Android developer’s site. If you are using Windows then you will need to visit the manufacturer’s page for your device and download the ADB and fastboot drivers for Windows. But first, let’s understand what are Android shell commands.

Android Shell Commands

ADB is Android Debug Bridge which is a command line utility included with Google’s Android SDK. It provides a terminal interface to control your Android device connected to a computer using a USB. ADB can be used to run shell commands, transfer files, install/uninstall apps, reboot and more. You can also backup and restore your android devices using these commands.

 

Want to test your Mobile App?

Join pCloudy Platform!

Signup for Free

 

pCloudy also allows you to execute ADB Shell Commands on the connected device to perform mobile testing.

 

Select your desired device from the list and connect.

 

Click on “Execute ADB” icon.

 

While trying to execute ADB Shell command, you just need to follow few simple steps as given below:

 

1. Select a device from the displayed list

 

click-on-connect-to-access-the-device

 

2. Confirm connection of your selected device

 

pcloudy-select-device

 

3. The connected device is ready testing

 

adb shell commands

 

4. Enter ADB shell command to the given text box

 

enter-adb-shell-command-to-the-given-text-box

 

5. Execute given ADB shell command

 

execute-given-adb-shell-command

 

6. Android ADB shell command execution result

adb-shell-command-execution-result

 

adb-shell-command-execution-result

 

Useful Android terminal commands:

1. ADB reboot-bootloader and reboot recovery commands:

This command will let you can reboot your device in the bootloader. If due to some malware your device is stuck or if your device is not rebooting then you can connect your device to the computer and run this command to reboot. To run the command just type adb reboot-bootloader in the command line and to boot the device in recovery just type adb reboot recovery.

 

2. Fastboot device command:

Fastboot is a diagnostic and engineering protocol that you can boot your Android device into. ADB does not work in the bootloader. If you have to boot into Android and the debugging tools are not active to communicate then you can use the fastboot command. Type fastboot devices in the prompt and you get the serial number.

 

3. Fastboot unlock command

Fastboot flashing unlock command unlocks your bootloader. This command is not supported in many phones that support fastboot but you can check if your phone supports it. Just type fastboot flashing unlock in the command prompt and hit enter.

 

4. ADB sideload command:

You can download the update zip file in your phone instead of waiting for the update to be pushed into the phone. To do that just download the update to your computer and connect your device to the computer. Now reboot into recovery on your phone and using the volume buttons choose to apply update from ADB. then open command line and type ADB sideload Full-Path-to-the-file.zip and hit enter.

 

A lot of users create android shell commands root in a device in spite of security. The adb reboot-bootloader command allows you to boot directly to your phone’s bootloader. Once you’re in the bootloader, ADB shell commands won’t work anymore. That’s where Android ADB fastboot command comes into the picture. Fastboot allows you to send commands to your phone while in the boot loader.

 

ADB Shell Commands for Reference

 

Adb Shell commands

Action performed by command

  • adb shell dumpsys batterystats

 

collects battery data from your device

adb shell ls

list directory contents

adb shell ls -a

do not hide entries starting with

adb shell ls -i

print index number of each file

adb shell ls -s

print size of each file, in blocks

adb shell ls -n

list numeric UIDs and GIDs

adb shell ls -R

list subdirectories recursively

adb shell netstat

list tcp connectivity

adb shell pwd

print current working directory location

adb shell dumpstate

dumps state

adb shell ps

print process status

adb shell am start -a
android.intent.action.VIEW -d

opens browser

adb shell am start -t image/* -a android.intent.action.VIEW

opened gallery

Want to test your Mobile App?

Join pCloudy Platform!

Signup for Free

 

Related Articles:

Anshuman Chatterjee

Anshuman Chatterjee is a technical consultant at pCloudy who enjoys traveling and singing. When he is not working, you would find him reading Sidney Sheldon and Agatha Christie.