I want to introduce you to this great method that reduce the hassle when you need to share files between your devices.
It is boring to always go around looking everywhere for that mini usb to usb cable or for the goddamn 8gb usb key that will probably be full of old files too…
Here i’m going to explain how to eliminate every medium (e.g. usb keys, external hard drives, cables), and share files using your local network.
Also is good to remember that you may have paid for that modem/router that gives you a internet, so why not to get the max out of it?
What do you need on the device where the files are stored, in order to share them?
- if it’s your smartphone or tablet (and any other android device):
- if it’s your pc (desktop, laptop, raspberry Pi, etc…)
Python is installed by default in almost every Linux distro, you just need to check what version is intalled; so open a terminal and type:
You may have a 2. or 3. version of python, it’s good to know because it changes what to type in the terminal, anyway it’s no big deal as i cover both options here.
Now you’re ready to share! I’m going to make a few examples but the main use is to launch the HTTP server on a device and to connect to it with a browser (such as firefox, chromium, vivaldi, etc..) on the other device.
from phone to pc
open simple http server and turn it on, check what’s the IP and PORT it’s serving and go there with your pc’s browser
Now you can go ahead and transfer your images, documents, videos and so on from your phone to a device
you can also stream some audio files in your browser instead of downloading them (as for videos, not all of them can be streamed by your browser, so scroll down to see how to stream them)
once you’re done, turn off the server and you shouldn’t be able to connect to it anymore
from pc to phone
you’re going to do the exactly same thing, but in a slightly different way; still you are going to serve on a port with a device and to connect to it with a browser on the other device
open your terminal and type:
for python 2
python -m SimpleHTTPServer [port]
for python 3
python -m http.server [port]
if no PORT value is set, it will automatically use the port n° 8000
Now open your phone’s browser to browser the pc files (press ctrl+c when you’re done):
ps. check your pc IP by typing:
you IP is there preceeded by “inet”
you can also type:
ifconfig |grep inet
ifconfig |grep 192.
Stream all kind of video and audio
You may have noticed that some audio and video files can ONLY be downloaded rather than played in your browser, or maybe when they stream the do at a very slow speed.
This happens because your browser can’t read by default all the different codecs, formats and so on.
To solve this you are simply going to use a video player to stream all kind of multimedia files.
I use VLC on both my PCs and android devices, so go ahead and install it (or whatever player you want to use)
now with your browser copy the link of the file that you want to stream and paste in vlc
there are many other things you can do like:
- share just some folders and not your entire home folder (keep your private stuff away from strangers)
- convert, cut, add filter, create a gif and many other options with FFMPEG without the need to have the source file saved on your device (e.g. you want to create a 1 second gif from an entire 5gb movie file, well you can do that without moving the 5gb file)
- and so on :)