I want to send some specific files from my linux PC to my android device. I'd like to send it automatically using terminal commands, so there will be no drag and drop files.
I don't know what is the best communication way to send file via wifi. I understand how to send using ftp by downloading 'ftp server' app on my android, but that's not suitable to my work since it needs to open an internet browser on my PC and transfer like a file manager. So I tried using ssh:
scp /home/user/picture1.jpg u0_a167@192.168.1.117:/storage/emulated/0
but always ended up error:
ssh: connect to host 192.168.1.117 port 22: Connection refused
lost connection
How to solve this problem? or does anyone have any other recommendation which communication way should I use?
Answer
You have different options here:
- SCP: As Dan already pointed out, Android soesn't ship with any SSH server by default. This means, to use SCP as described in your question, you will first have to install an SSH Server App on your device.
- FTP: Other than you're assuming in your question, FTP can be scripted. But that might not come as easy as a simple
scp
command. And like with SSH, you first will need to install an FTP Server App on your device as well.
Important note: Many FTP clients/connections default to ASCII transfer mode. If you want to copy binary (basically: non-text) files like images, audio/video, etc., make sure you're in binary mode (when using the command-line, that can be done by issuing thebin
command). Otherwise you might get "broken files" on the receiving end. - ADB: This is an option Android even ships with, but by default bound to an USB connection. You'd just need to enable USB Debugging in developer settings, connect your device via USB, and then can use commands like
adb push
oradb pull
to put files on your device or retrieve them from there. As you prefer doing that via WiFi, there are several apps providing this as well.
There might be additional possiblities, but the three mentioned above are the most used.
No comments:
Post a Comment