Transferring files from/to Android devices is as easy as plugging the USB cable and turning on MTP/File Transfer mode. But what if the option isn’t available in a given situation?
Advertisement
That’s where the ADB Pull and ADB Push commands come into play. In this guide, we will show you how to use ADB Push and ADB Pull commands to transfer files between your PC and your Android device.
ADB (Android Debug Bridge) is a versatile tool and a part of the Android SDK platform-tools package which is often used by Android developers, or enthusiasts who would like to tinker with the software. But it also offers features that could come in handy to an average user too. The Pull and Push commands of ADB are one of them and could be used to copy files from your PC to your Android device (or vice-versa) by just using a command.
Advertisement
Page Contents
Usage of ADB Push & Pull Commands
So when would you need to use ADB Push and ADB pull commands to transfer files to and from your Android device? There are quite a few situations where ADB Pull/Push can make things easier for you and even get you out of tricky situations. We have discussed some of these situations below.
1. For an average user
If your PC cannot recognize your Android phone even after enabling MTP/File Transfer mode. Yes, this could certainly mean that you don’t have the appropriate USB drivers installed. But what if you do have them installed and your PC still doesn’t detect the phone. Chances are your PC can still recognize your phone over ADB and if that’s the case, then you can use the commands to transfer files.
Note: This is not the ultimate solution, you’d still need to troubleshoot your PC and resolve the issue with the USB drivers.
Basically, using ADB Push and Pull commands isn’t something that an average Android user might need. But it makes sense to be acquainted with these commands just in case you might need them.
2. For an Android enthusiast (a.k.a flashaholic)
Let’s say you’re in the midst of flashing a custom ROM which requires you to wipe the OS in TWRP, sometimes even the data partition/internal storage. You’d realize that the flashable ZIP of the custom ROM that you transferred has been erased (Don’t worry, it happens to the best of us). In such a case, you can just connect your Android device to the PC and use the ADB Push command to copy files from your PC to your device.
Sometimes, TWRP cannot even decrypt the data partition, which means you could not access your phone’s internal storage to flash ZIP files. This is quite common with newer Android devices running the latest Android version (e.g. devices running Android 12/13 ). TWRP for your specific device could still be in development. But that shouldn’t stop you from flashing files either. So, you can use the ADB Push command to transfer zip files to a temporary directory (/tmp/*
) and flash it right from there.
Another situation is while you’re installing Magisk on your device, in where you patch the stock boot image using Magisk. Now before you can flash the patched boot image to your device, you must first transfer it from your device’s storage to the PC. Transferring the image via MTP/File Transfer mode is known to corrupt the file. And this is when the ADB Pull command can specifically be helpful. You can use the command to pull the patched boot image from the device to the PC.
3. For Android App and ROM Developers
Developers often go through cycles of testing and debugging during the development process, and also after it, to iron out bugs/issues. And ADB is probably their best friend, which not only helps them in debugging but also makes the process much easy. If you’re a developer, then you can use ADB commands to push or pull files like logs, reports, or APKs to or from your Android devices pretty quickly.
Now that you know when you might need to use the ADB Push and ADB Pull commands, let’s get to the instructions on how to use them to transfer files.
Preparations
If you’re a developer or someone who often keeps fiddling with your Android phone’s software, you might already have everything set up and ready-to-use on your PC. But if you’re new, then you must first prepare both your PC and your Android device before you can start transferring files using ADB Push/Pull commands.
- First of all, you must install ADB on your Windows, macOS, Linux PC and open the command-line window where ADB is installed. Optionally, you can also configure ADB to be used from any directory on the PC using the instructions here.
- Next, enable USB debugging switch on your Android device.
Once you have done the above, head down below to the instructions on how to transfer files between your PC and Android device using ADB Push and ADB Pull commands. Make sure that you go through the steps and then read the explanation thereafter to fully understand their usage.
How to Use ADB Push to Transfer Files from PC to Android Device
- Connect your Android device to the PC using a USB cable.
- Copy the file (ZIP, APK, etc) that you want to transfer to the folder where ADB is installed on your PC.
- Launch the Command Prompt/PowerShell or Terminal in the same folder.
- Now type the following command:
adb push <local location> <remote location>
⇒ “
<local location>
” is the full path to the file/directory on the PC.
⇒ “<remote location>
” is the path of location on the Android device where you want to transfer the file/directory. - Hit ‘Enter’ on the keyboard to execute the command.
- The progress of the transfer will be shown in the command-line window.
- Once the file has been transferred, you can disconnect the Android device from the PC.
How to Use ADB Pull to Transfer Files from Android Device to PC
- Connect your Android device to the PC using a USB cable.
- Launch the command-line window in the folder on the PC where ADB is installed.
- Now type the following command:
adb pull <remote location> <local location>
⇒ “
<remote location>
” is the full path to the file/directory on your Android device.
⇒ “<local location>
” is the path of location on the PC where you want to transfer the file/directory. - Hit ‘Enter’ on the keyboard to execute the command.
- The progress of the transfer will be shown in the command-line window.
- Once the file has been transferred, you can disconnect the Android device from the PC.
Explanation
Now, the instructions above offered you the syntax of using the commands. Now, let’s show you how the ADB Push and ADB Pull commands exactly work, along with an example for each.
Like I mentioned above, these commands aren’t something that a normal day-to-day Android user would need. But it’s good to know that you have them as an option when everything else fails. For developers and power-users who constantly work with ADB, these commands can come in really handy and takes out the extra effort of enabling MTP/File Transfer mode and then moving the files.
So, to start off, you have to make sure that ADB is properly set up on your PC, which is quite obvious since you are going to use ADB commands. Next, you have to enable Developer Options on your Android device and further enable the USB Debugging option within it. The options are hidden by-default as an extra layer of security, so that a normal user may not end up messing with them without any prior knowledge.
Do note that USB Debugging only needs to be enabled to successfully interact with your device over ADB, when the device is booted into the actual OS. If you’re going to use the commands while your Android device is in TWRP recovery mode, then you do not need to enable USB Debugging.
- Note: Please stray away from online resources which might tell you that USB debugging must be enabled in order to use ADB commands while in recovery mode (stock or custom, it doesn’t matter).
Once that is done, you just have to connect the device to the PC using the USB cable and launch the command-line window (PowerShell/CMD in Windows, or Terminal in macOS/Linux). Make sure that you open the command-line in the same folder where the ADB tool is installed (not needed if ADB is configured to be used system-wide). After that, you just have to enter the commands. Read below for further explanation along with the example.
As noted by our fellow reader Gio, the adb push
command does not copy over hidden files and directories (dot files like .nomedia
etc). To make sure that the hidden files/directories are transferred as well, you will need to supply the -p
flag/option in the command.
Example:
adb push -p <local file> <remote location>
1. Example of using the ADB Push command
Now, the command to push a file from PC to Android device should start with “adb push”, followed by a space and the full path to the location of the file on the PC (referred as “<local file>” in the instructions above) that you want to transfer. After that, you have to add another space and enter the path to the location on the device where you want to transfer the file (referred to as “<remote location>” in the instructions above).
For example: Let’s say I want to push a file named “ota.zip” located in the “C:\platform-tools” folder on my PC to the “Download” folder of my device’s internal storage. In that case, the command should look like the following:
adb push C:\platform-tools\ota.zip /sdcard/Download
⇒ Here “C:\platform-tools\ota.zip” is the full path of the file that I want to transfer from the PC. And, “/sdcard/Download” is the location on the device where I want to transfer the file.
2. Example of using the ADB Pull command
On the other hand, the command to pull/copy a file from Android to PC should start with “adb pull”, followed by a space and the full path to the location of the file on the device (referred to as “<remote file>” in the instructions) that you want to transfer. After that, you have to add another space and enter the path to the location on the PC where you want to transfer the file (referred to as “<local location” in the instructions above).
For example: If you want to pull a file named “magisk_patched.img
” located in the “Download” folder of my device’s internal storage, to the “C:\platform-tools
” folder on my PC, then the command should look like the following:
adb pull /sdcard/Download/magisk_patched.img C:\platform-tools
⇒ Here, “/sdcard/Download/magisk_patched.img
” is the full path of the file that I want to transfer from the device. And, “C:\platform-tools
” is the location on the PC where I want to transfer the file.
I hope the examples have given you a clear idea of how the commands work. If you still feel confused, you should give it a try and it won’t do any harm. If you input a wrong command, the command-line will instantly show an error message. If you enter the correct path and the command is successful, then you should transfer progress in the command-line itself.
So that’s how you can use ADB Push and Pull commands to transfer files between your PC and Android device. This is one of the many articles in our Android 101 series, where we teach you the basics of Android. We hope you find this article and the whole series useful. If you have any questions regarding the said commands or their usage, please let us know via the comments.
Comments 7 Comments
I would like to add that “
adb push
” does not copy over hidden files or empty directories. However with the “-p
” option hidden files/directories are copied as well.Unfortunately, for the empty folders, it seems that the only way is to “touch” an empty placeholder inside.
It took me a while to discover the above when I was trying to restore my Syncthing folders into a new phone and could not copy over the “
.stversions
” and “.ststandard
” folders which cause Syncthing to ignore them.Thanks for sharing your insights, Gio. I have added the information under the Explanation section of the article. I am sure it will prove useful to other users.
I am also curious to know how you came across this flag? And does this apply only to
adb push
, or is it applicable toadb pull
as well?For pushing a file to the device using
⇒ “” is the path of location on the Android device
What could be the most easily accessible location like with no permission issues etc. ?
Prasad, any location on your device’s storage should be fine. I personally prefer the root of the internal storage, that is, outside all the folders. It helps me easily locate the transferred file(s).
Use case 5: On my honor 6x, I cannot use file explorer to directly push the file to my phone. Installing the APK using the
adb install
command was not working. So I usedadb push
to push the APK file.Addendum:
Use Case 4. For people who think MTP is a steaming pile of doodoo.
I’m now using adb push on my linux desktop to manage mp3s on my phone’s sd card. So quick & reliable, it makes me wonder how they managed to make MTP so slow & unreliable!
Jerry, I couldn’t agree more. While several phones now utilize UFS storage, it’s surprising to see transfer speeds still slow when using MTP in certain circumstances.
For instance, transferring a 3.04 GB of OTA package to my OnePlus 8 via MTP took only 73 seconds, while using ADB push it took 81 seconds.
But when transferring the same file from my MacBook, ADB push merely took 57 seconds whereas with the Android Transfer Tool it was 75 seconds.
I am not sure if it correlates with the USB port being used. Because on my Windows computer, I only had USB 3.1 gen ports, while on my Macbook, I used the USB 3 port. Further, it could also depend on the storage technology being used by the device (EMMC or UFS), and if UFS, then which revision of it.
Anyhow, as you said, it did make a difference for you. So, I will make sure to add a fourth use case.