Skip to main content

Simple Python HTTP Server on Linux

Sometimes we need to share files and folders quickly. Often emailing stuff to people tends to be cumbersome. I have noticed that creating a simple http server comes in really handy in such scenarios.

Fortunately in linux, it's really simple to create a http server with Python if you don't want to mess around with apache or the likes. All it takes is a single line of code. Okay, let's cut to the chase. Here's how you do it :
1.Change your pwd to the folder that you would like to share
cd /home/some_directory
2.Once you have done that, type in the following:
sudo python -m SimpleHTTPServer 80
This will create a http server at port 80 and you will get the following message :
Serving HTTP on 0.0.0.0 port 80 ...
Now open a browser and type
http://192.168.1.2:80
assuming that your ip address is 192.168.1.2
Press ctrl+c to stop the server

Comments

  1. Me and my colleagues used your hints while working with data room . It was helpful.

    ReplyDelete

Post a Comment

Popular posts from this blog

What does sudo apt-get autoremove do ?

sudo apt-get autoremove Whenever you install an application (using  apt-get ) the system will also install the software that this application depends on. It is common in Ubuntu/Linux that applications share the same libraries. When you remove the appplication the dependency will stay on your system. So  apt-get autoremove  will remove those dependencies that were installed with applications and that are no longer used by anything else on the system.