14Oct
2021

Useful ADB commands..

By Avijit 0 comments 5k Times Viewed


ADB stands for Android Debug Bridge. It is a command line tool to interact with your android device from a computer. Using adb commands you can a lot of things such as installing and debugging android applications, changing your device screen size and so many things which are not so easy and some are not possible without the adb tool. And it also provides you access to the unix shell where you can enter commands to the mobile. As there there are command line interface in windows and terminal in linux, android also have a command line interface. We can access the shell using the adb. In this article we are going to discuss about some very important adb commands that will you should know.


Enable usb debugging on your mobile to use the adb shell.

To use the adb commands you need to enable the USB debugging feature of your device (The android device on which you want to run the adb commands). The process is shown below.

  • On the android device open settings..
  • Tap on About phone or System .
  • Tap on Build number for seven times.
  • Then the developer option will appear and click on it. Turn it on if it shows turned off.
  • Scroll down and enable the USB debugging option.


Configure ADB

If you are using android studio then you can download adb using the sdk manager.

  • Tap on tools-> SDK manager
  • Select the "Android SDK Platform tools".
  • Click Ok

Now android studio will download the sdk platform tools.

Alternatively you can also download the Android sdk platform tools package

Now you can use the adb shell. To do that, go to platform-tools folder you have downloaded just now and open command prompt there. Or you can copy the path of the folder and then open cmd from anywhere then go to that directory via cd copied_directory command.

adb tcpip 5555

Before this command you need to connect your android device with the pc using a cable for once. So connect the android device with your pc using a wire and then enter the command. You will see a output like following.

tcpip
Fig.2 - tcpip command

adb connect [deviceIp]

adb devices
Fig.2 - adb connect

This command will connect both the devices over wifi. You have to put the local ip of the device after "adb connect" in the command .Then the device will be connected to the pc over wifi. You can now remove the the wire and debug over wifi. You can now also check the connected devices using the following command.

adb devices

adb devices
Fig.2 - adb devices command

adb reboot

This command reboots the connected device. This command has no output in the terminal. It just reboots the device.

adb push

adb devices
Fig.2 - adb devices command

There are a lot of applications for sending files between your computer and your andorid device. But you can also transfer files between your mobile and computer using comand line interface and android debug bridge. By using adb push Source Destination command you can send file from specific directory to another specific directory of your andorid device. (Here 'Source' is the directory of the file in your computer and 'Destination' is the directory where you want to send the file.

adb pull

adb devices
Fig.2 - adb devices command

For sending files from your android device to your computer you can use this command. This command is also same as adb push where you can specify file location and file name from the mobile device and destination location. The sample command is adb pull Source Destination where 'Source' is the file directory of the file you want to transfer from the mobile to your computer and 'Destination' is the file directory of the destination ( which is a directory in your pc) where you want to transfer you file.

adb install apkLocation

If you want to install an application from your computer to your android device just only using adb this the command. Using this command you can install an apk in your android device by specifying the destination of that apk file.

adb shell command

adb devices
Fig.2 - adb shell command

Using this command you can perform any type of commands directly into the shell of the devices connected through adb. The 'command' portion in the 'adb shell command' is the command that you want to perform in the device shell. For example the adb shell ls command will perform a ls command execution in the connected device and will show the list of available files in the root directory of the android device.

adb shell

adb devices
Fig.2 - adb shell command

Using this command you can directly enter into the unix shell interface of the android device. Entering into the shell you can do whatever you want with the shell of that device.

adb --help

Finally this is the most important commands for you if you are a beginner. You can learn about the adb commands using this command.

Some text some message..