Are you a Linux or macOS user? Today we have a good tip for you! At a time when digital tools have been a strong ally of human communication, nothing better than knowing their potential.
The tip we bring you today is very simple and allows you to create a Web server in just 1 second! Do not believe?
Do you find it difficult to share files between a Linux system and, for example, a Windows system? It is true that Samba may not be the best option for less experienced users and we feel that today we bring an alternative.
Learn how you can share files and directories with a single command on your GNU / Linux and macOS.
The Python programming language is a very high level language (VHLL – Very High Level Language), interpreted and interactive, which was created by the Dutchman Guido Van Rossum. This is an object-oriented, modular language, with a very intuitive syntax and very simple to learn. Like Perl, the Python source code is available under the GNU General Public License (GPL).
On the Internet we can find a lot of documentation about this fantastic programming language that is used by the main technological players, in the most diverse services.
How to create a Web server in 1 second using Python
Through the SimpleHTTPServer integrated module we can quickly create a Web server and make the contents of a given directory available. This feature is important when we want to share that content in a simple and fast way.
For that, let's go to an example. Let's start by creating a directory using the following commands:
Then run the Python SimpleHTTPServer module
python -m SimpleHTTPServer
From that moment on we started to have a Web server active that will make the contents of the folder available online. To do this, just use the machine address and the indicated logical port. The result will be something like that.
If the user wants to change the communication port, he can use the command:
$ python -m SimpleHTTPServer And it's as simple as that!
And it's as simple as that!