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:

  1. Go to the Terminal.
  2. Browse to the folder you want to share.
  3. Run this command:
    python -m SimpleHTTPServer
    (The syntax is python -m SimpleHTTPServer portno.; the default port no. is 8000)
  4. 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}').
  5. Open a browser in the device you want to get the file.
  6. Go to http://your-ip-address:8000
    (For eg. http://192.168.1.6:8000)
  7. You must get a list of files in the folder you chose. Download whatever you want.
  8. Go back to the running terminal and type ctrl+c to end it.
The Terminal and the command after browsing to the required directory.
The Connection Information box where you can get your ip address.




Comments

Popular posts from this blog

Distro Dilemma of a Linux Nerd

squRemote