Abhiuday.dev
← All Scripts•
Bare-Metal Logs #04
•Watch Reel (0:36) ↗

Share a Folder to Your Phone Over Wi-Fi

Send files from your laptop to your phone without uploading them anywhere. One command serves a folder on your Wi-Fi, and your phone opens it in the browser. No app, no cable, no cloud.

// Steps

  1. 1.Make a folder and put the files in it

    ❯mkdir ~/share

    Copy the files you want on your phone into this folder.

  2. 2.Start sharing

    ❯python3 -m http.server 8000 --directory ~/share

    Leave this running. It serves the folder on port 8000.

  3. 3.Find your laptop's address

    ❯ipconfig getifaddr en0

    On macOS. On Linux, use hostname -I instead.

  4. 4.Open it on your phone (same Wi-Fi)

    ❯http://<that address>:8000

    Replace <that address> with the address from step 3. Tap a file to download it.

  5. 5.Check it is running

    ❯curl -I http://localhost:8000

    You should see HTTP/1.0 200 OK.

  6. 6.Stop sharing

    ❯Control C

    Press Control C in the terminal where step 2 is running.

// Before you use it