Serving HTTP from your Linux terminal

There is a very useful python module called SimpleHTTPServer that lets you create a webserver instantly. Say you have a huge file (50-60gb) and you want to send it to someone across the campus, then you have a use for SimpleHTTPserver.

First get to know the hostname of your server, just type hostname and press enter, it will return yourhostname

Then type,

python -m SimpleHTTPServer

That’s it! you can now access all your files in that directory through browser using this url:

http://yourhostname:8000/

It will stay as long as you let that command run (to kill it just type Ctrl + C).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s