Python One Liner

I keep forgetting this simple way to start a HTTP server to serve files from the current directory… Now it’s going to be here for eternity

python -m SimpleHTTPServer

Then point browser to http://localhost:8000
This blog shall become an extension of my brain…

2 thoughts on “Python One Liner”

  1. How about making an alias on your unix machines ? For commands we hate remembering or for long commands it’s very helpful.

    Here are two examples straight out of my own .bashrc file on Ubuntu :

    alias listOfOpenPorts=’sudo netstat -lntp’
    alias pcards=’cd /home/nick/workspacePcards’

    As a matter of fact, I’ll be adding the next one right about now :)
    alias startHTTPServer=”python -m SimpleHTTPServer”

  2. I used to have aliases like you suggest, then I had trouble working on someone else’s computer… That was a long time ago though, maybe I’ll try again.

    Since I work on 3 computers more or less regularlly these days, I plan on have my config files on github. It will help me to keep everything in sync. That will be a big help.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>