Run a http server from any directory on Linux

cool_penguin_smallMany a time we need to share files over the LAN. There is a very simple way of doing it when you are on Linux using python2. cd to the directory the contents of which you want to share and run:

//Python 2
$ python -m SimpleHTTPServer 8181

//Python 3
$ pyhton3 -m http.server 8181

Here, 8181 is the arbitrary port number you want to use for your HTTP server. The files can now be accessed from any system in the LAN using a browser at


Another interesting utility is nweb.

Tested it between my laptop and mobile over the wireless and worked fine. Happy sharing!

2 thoughts on “Run a http server from any directory on Linux”

  1. This only works for python2. Version 3 uses a different module (python3 -m http.server)

    The best part about this is that it works on a lot more than just Linux (like the BSDs or on a mac)

Leave a Reply

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