The only requirement, as far as I can tell, is python. I’ve run it on my Linux machine as well as my OS X machine and it worked just fine with no other configuration or packages installed. It should likely work on anything else that has python installed as well.
To share the contents of any folder on your machine simply run:
python -c "import SimpleHTTPServer; SimpleHTTPServer.test();"
You can run that one-liner anywhere on your file system and then access the files via your browser. Simply point your browser to your LAN IP port 8000 and you should see an index listing of the files.
To make this a little simpler I made it an alias in my .bashrc file. Just add this line somewhere in your .bashrc or .bash_aliases:
alias webshare='python -c "import SimpleHTTPServer; SimpleHTTPServer.test();"'
At this point you can simply run the command webshare anywhere on your file system and share those files. This makes for a really simple tool for sharing files quickly and un-sharing them as soon as you’re done. Just hit ctrl-c to cancel and close the process.
source ubuntu-tutorials.com
No comments:
Post a Comment