Simply serve local directory via HTTP with python webserver

Sometimes you quickly need to exchange some files between networked machines. A really easy way that mostly also works through firewalls is to serve them via a local webserver. Python offers a really simple module for that:

python -m SimpleHTTPServer

To serve a local directory just run:

[email protected]:~$ python -m SimpleHTTPServer
Serving HTTP on port 8000 ...

The IP “” means that your webservers listens on every IP address that is bound to your network interfaces. You can find your IP with the command /sbin/ifconfig

[email protected]:~$ /sbin/ifconfig
eth0 Link encap:Ethernet HWaddr 00:11:22:33:44:55
inet addr: Bcast: Mask:

And then point your browser (or wget / curl) the IP with port 8000 – so in this case to
You will get a directory listing and you can download files.

[email protected]:~$ python -m SimpleHTTPServer
Serving HTTP on port 8000 ... - - [13/Feb/2015 08:51:17] "GET / HTTP/1.1" 200 - - - [13/Feb/2015 08:55:56] "GET /Documents/work/sample.txt HTTP/1.1" 200 -