Simple filesharing in Linux – Python HTTPServer

So, want to show something on your machine to another user? Or want to share a file ?
If you have Python installed (default for most *nix systems) the following trick is awesome.

Create the following alias in your .bashrc

alias webshare=’python -c SimpleHTTPServer’

Now just type the command “webshare” in your terminal, and all files in current folder and beneath will be available at

http://localhost:8000

If you dont want to create an alias, just type the following command in your terminal

python -c “import SimpleHTTPServer;SimpleHTTPServer.test()”

Remember, if you start the webserver in your /home/username; folder, you share everything in the folder !

Leave a Reply

Your email address will not be published. Required fields are marked *