While most people will switch a device to MTP mode when they want to copy a file to or from an Android device, it’s actually possible to do it with the ADB Push command. Since this process can be complicated for those who are unfamiliar with it, this guide will walk you through it from start to finish.
Setting a device to MTP mode in order to copy something to or from it is definitely the easiest route, but sometimes it simply isn’t an option. A great example of this is when we are currently booted into TWRP and have done something like formatted the /data partition. Once that is done, any custom ROM file that we had stored there is gone and we need to use ADB Push in order to copy the ZIP file back onto the smartphone or tablet we are currently working on.
Using ADB Push isn’t something that I generally recommend unless you have no other way around it. I will always switch my smartphone to MTP mode when I want to copy files to or from my device. Still, this is something that everyone should know about just in case you happen to need it. I hardly ever recommend it because it simply isn’t needed, but it’s still something that Android enthusiasts should know about. You don’t even need to memorize the process as you can also refer back to this tutorial when you need to.
This step by step guide will give you the basic syntax for the command but I’ll be explaining my example in the section right below it.
In order to complete the tutorial below, you're going to need some things set up ahead of time. Please follow the how to install ADB and Fastboot tools guide if you haven't done so already. Then you will need to follow the how to enable Developer Mode guide, as well as the tutorial that shows you how to enable USB Debugging Mode. With USB Debugging Mode granted from the PC the phone is connected to, you can then test this by running the command "adb devices" (without quotes) in a command prompt or PowerShell to make sure the computer recognizes the device.
Using ADB Push to Copy a File to Android
- Connect the USB cable to the device from the computer
- Move/copy the file to the same folder as your ADB tools
- Launch a Command Prompt or PowerShell in that same folder
- Type the following command. . .
- adb push <local file> <remote location>
- . . .and press Enter on the keyboard
- Wait for the file to be sent from the PC to Android
- Then disconnect the USB cable
So yea, ADB Push isn’t something that I use a lot but knowing how to do it is invaluable for those times when it’s needed. Just make sure that if you’re currently in Android that you have USB Debugging Mode enabled as Android will prevent this transfer from happening thanks to a security layer that is currently in place. When we’re booted into TWRP or something though, this isn’t required and you should be able to just copy a file to where ever you want without needing to worry about that.
So once you have USB Debugging Mode setup and ready to go, we can then open up a Command Prompt or Windows PowerShell in the same folder as your ADB tools. From here, we can then type out the command as instructed above. As mentioned, that is just the syntax for the command but let me explain this in further detail. As you can see from the image at the top of this article, the command I did was adb push file.zip /sdcard/Download – and then I did another that was just adb push file.zip /sdcard
Now when we break this down we first have the command itself, ADB Push, this is what tells the ADB.exe file that we are going to be sending a file from the PC to the Android smartphone or tablet. We then need to designate which file we are going to send and we do this by typing out the filename of that file. In my example this was Magisk-uninstaller-20170813.zip, but it just needs to be any file you have in your ADB tools directory. The next part of this command is the remote location which is both /sdcard and then /sdcard/Download in my example.
It doesn’t matter where you move the file as long as it is somewhere within /sdcard as that is the root directory of your internal storage (even if you don’t have a device with a microSD card slot). The /sdcard directory is just the folder Android uses as your internal storage. You could even create a new folder here and copy the file to something like /sdcard/Magisk even if there isn’t a folder called Magisk in your internal storage drive. It will just create the folder and move the file there when you finish the ADB Push command.
If you’re still confused about all of this, go in and experiment to see how the command works. You won’t break anything as you’ll just see an error in the Command Prompt or PowerShell if you typed something wrong or don’t have it properly setup. You won’t break anything or lose any of your data by experimenting with this command.
If this tutorial helped you in any way, please consider donating at Patreon or PayPal. If you can't afford to donate then sharing this on social networks such as Facebook, Twitter, etc. will also help a lot.