The other day I was talking with a co-worker regarding solutions to easily sharing files within the LAN. I have always used solutions like Lighttpd/Apache, or even Dropbox, but he had a suggestion that ended up being even simpler and more dynamic.

The only requirement to this share is having Python installed, which is pretty much a requirement these days anyway. Heh, I even used this method on my Mac without any additional setup.

The first thing that I do here is create a shell alias so that I don’t have to remember/type the full command. Edit your .bashrc or .bash_aliases and add the line:

alias webshare='python -c "import SimpleHTTPServer;SimpleHTTPServer.test()"'

. .bashrc && . .bash_aliases

You should now be able to run the alias webshare anywhere on your filesystem and be able to share those files with anyone that has access to your IP.

When you run the command it will tell you the IP and port that your share is accessible on. By default it should be 0.0.0.0:8000. This means all interfaces on port 8000. Simply share your LAN IP with those you want to share with and there you go!

To stay up to date with Root Certified consider subscribing to our RSS feed.

Tags: , ,