...making Linux just a little more fun!

2-Cent Tips

2-cent Tip: 'Serve' your current directory

Amit Saha [amitsaha.in at gmail.com]


Thu, 2 Apr 2009 14:57:59 +0530

Hello all,

Perhaps this is too simple to be a 2c-tip, but still a tip. :)

The following script (either run by hand) or in a script starts up a HTTP server and makes available all the files and directories from which it is started, so as to make them available over the network:

python -m SimpleHTTPServer &

By default, it starts off the server on '8000' but that can be changed using:

python -m SimpleHTTPServer 9090, which starts the server on 9090, and can be accessed via the browser or any HTTP client using:

firefox http://127.0.0.1:8000/

More on the Python module at http://docs.python.org/library/simplehttpserver.html

Thanks, Amit

-- 
http://amitksaha.blogspot.com
http://amitsaha.in.googlepages.com/
*Bangalore Open Java Users Group*:http:www.bojug.in
 
"Recursion is the basic iteration mechanism in Scheme"
--- http://c2.com/cgi/wiki?TailRecursion

[ Thread continues here (7 messages/8.60kB) ]



Talkback: Discuss this article with The Answer Gang

Copyright © 2009, . Released under the Open Publication License unless otherwise noted in the body of the article. Linux Gazette is not produced, sponsored, or endorsed by its prior host, SSC, Inc.

Published in Issue 162 of Linux Gazette, May 2009

Tux