Quickly Share Files on LAN with a One‑Line Python HTTP Server

This guide shows how to instantly create a lightweight HTTP server using a single Python command, enabling fast LAN file downloads and uploads, with step‑by‑step instructions, command examples, IP discovery, and screenshots for both Python 3 and Python 2 environments.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Quickly Share Files on LAN with a One‑Line Python HTTP Server

When you need to quickly share a file or folder with colleagues on the same LAN, you can start a simple HTTP server with a single Python command.

Python 3

Run the following command (replace 8000 with any free port): python -m http.server 8000 The command serves the current directory, listing files and allowing downloads. Access the server from another device by entering http://<em>server_ip</em>:8000 in a browser.

Python 2

Run the equivalent command: python -m SimpleHTTPServer 8000 Then open a browser on a phone or another computer and navigate to the same URL. The displayed files are those in the directory where the command was executed.

Note that the server runs in the foreground; pressing Ctrl+C stops it.

To find the server’s IP address on Linux, use the ifconfig command.

Effect as shown in the screenshots:

After obtaining the IP address:

Enter IP:port in a browser to see the file list and download files:

Download proceeds directly:

If the folder contains an index.html, the browser will render it as a web page. Otherwise, files such as PDFs can be opened or downloaded directly:

To enable uploads from a mobile device, a small Python script with an HTML upload form can be used. The following screenshots show the upload interface and successful transfer:

Select a file to upload:

Upload succeeds and the server side shows the received file:

This lightweight approach provides a fast, ad‑hoc solution for LAN file sharing without needing to configure FTP or other services.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

PythonBackend DevelopmentHTTP serverLAN file sharingSimpleHTTPServer
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.