Real Easy Way To Transfer Files From Linux
Windows has Homegroups that make transferring files on a network real easy. This had me wondering: what do we Linux users have when we need to send a huge file to another computer really quick?
I had run into this problem once before, when a quick Google search did not yield anything quick and easy. I had accepted that Linux is too geeky to have such easy solution. A solution without a couple of pages of code is too boring, right?
Recently, I was Googling for a way to make my Android talk to my Linux system for a project, when I stumbled upon the perfect solution to my old problem.
Turns out there is a very easy way to create a server with python, and host any folder in your computer to that little server. Then, any device (Windows, Linux, Mac, Android, anything) in your network can access that folder (and its sub-folders) and download anything. You just need to be connected to the same wi-fi, for example.
Here's how you can do it:
I had run into this problem once before, when a quick Google search did not yield anything quick and easy. I had accepted that Linux is too geeky to have such easy solution. A solution without a couple of pages of code is too boring, right?
Recently, I was Googling for a way to make my Android talk to my Linux system for a project, when I stumbled upon the perfect solution to my old problem.
Turns out there is a very easy way to create a server with python, and host any folder in your computer to that little server. Then, any device (Windows, Linux, Mac, Android, anything) in your network can access that folder (and its sub-folders) and download anything. You just need to be connected to the same wi-fi, for example.
Here's how you can do it:
- Go to the Terminal.
- Browse to the folder you want to share.
- Run this command:
python -m SimpleHTTPServer
(The syntax ispython -m SimpleHTTPServer portno.
; the default port no. is 8000)
- Find out your computer's ip address (Go to Connection Information in the Networks menu in Ubuntu or run this command in the Terminal:
ifconfig wlan0 | grep "inet addr" | awk '{print $2'} | awk -F: '{print $2}'
). - Open a browser in the device you want to get the file.
- Go to
http://your-ip-address:8000
(For eg.http://192.168.1.6:8000
) - You must get a list of files in the folder you chose. Download whatever you want.
- Go back to the running terminal and type
ctrl+c
to end it.
The Connection Information box where you can get your ip address. |
Comments
Post a Comment