Instant LAN File Sharing with one command in Ubuntu

This post was written by admin on September 6, 2009
Posted Under: Internet

If you want to share files over the LAN quickly and easily and do not want to mess with apache or any http daemon.

You just need to openup a terminal window and run this command:

python -c "import SimpleHTTPServer; SimpleHTTPServer.test();"

or

python -m SimpleHTTPServer

For example,in terminal navigate to Download folder and run the command:

wraith@wraith-desktop:~/Download$ python -c "import SimpleHTTPServer; SimpleHTTPServer.test();"
Serving HTTP on 0.0.0.0 port 8000 ...

People within your LAN,should get your /home/username/Download folder by type yourip:8000 in browser.

file_sharing1

You can also make this command more simpler by adding this line to .bashrc or .bash_aliases in your home folder(Ctrl+H to view hidden files).

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

Now,reboot and you can run the command LANshare anywhere on your file system and share those files.

Related posts:

  1. Simple Http Server support uploading files from Windows in Ubuntu
  2. Easy file receiving from friends on the internet with Droopy
  3. feh – lightweight command-line (command console) image viewer for Linux
  4. Sharing Desktop Files with Giver
  5. Nautilus-terminal,integrate command line interface into Nautilus file browser

    Tags:

    Reader Comments

    thanks, great tip.

    also you don’t need to reboot your system after editing .bashrc

    just issues this command:

    source .bashrc

    [Reply]

    #1 
    Written By natty on August 11th, 2010 @ 7:35 pm

    Too damn cool,
    python does it again
    Thanks man

    [Reply]

    #2 
    Written By Jatin Gera on November 27th, 2011 @ 11:20 pm

    Awesome finding, quickest way to do it. Very helpful article. Thanks for sharing. Python rocks.

    [Reply]

    #3 
    Written By Viks on December 14th, 2011 @ 12:00 pm

    Awesome, simply awesome !!! :)

    [Reply]

    #4 
    Written By Lokesh Walase on December 18th, 2011 @ 8:51 am

    Add a Comment

    required, use real name
    required, will not be published
    optional, your blog address