Wednesday, July 29, 2009

How to Share Files quickly in Ubuntu / Debian Linux

In the very first day of my python study, I wondered!!!
Some time we need to share files to other systems in our computer center quickly with out any tools in hand. If you have a python installation in your system, file sharing is very simple by implementing a little http server, using a single line command.

Suppose If you want to share the folder /home/shibu/ and my IP address is 192.168.0.4

open a terminal then type following
$ cd /home/shibu

$ python -m SimpleHTTPServer

Now your http server will start in port 8000
( You will get a message - Serving HTTP on 0.0.0.0 port 8000 ... )

Now you can open a browser in the remote machine and type the following in the address bar

http://192.168.0.4:8000

If you are a network administrator it is very useful, normal users can also use this trick.

you can test it locally by using
http://127.0.0.1:8000