Trick: simple server

Here is where you can post tips and tricks to share with other users of MX. Do not ask for help in this Forum.
Post Reply
Message
Author
User avatar
Adrian
Developer
Posts: 8250
Joined: Wed Jul 12, 2006 1:42 am

Trick: simple server

#1 Post by Adrian »

If you need to share something quickly over the internet you can start a quick http server by running:

Code: Select all

python -m SimpleHTTPServer 8000
(use instead of 8000 whatever port you want to use)

This should start a server and share whatever you have in the folder you run it from (so be careful where you run it)

It's accessible on http://localhost:8000 to test, and on your http://enter_your_ip:8000

The alternative python3 command is:

Code: Select all

python3 -m http.server 8000

User avatar
PhantomTramp
Posts: 97
Joined: Tue Jul 10, 2007 12:53 pm

Re: Trick: simple server

#2 Post by PhantomTramp »

Might have to create port forward in my router but this is awesome!

Many thanks,

The Tramp

User avatar
Jerry3904
Administrator
Posts: 21881
Joined: Wed Jul 19, 2006 6:13 am

Re: Trick: simple server

#3 Post by Jerry3904 »

How do you stop it?
Production: 5.10, MX-23 Xfce, AMD FX-4130 Quad-Core, GeForce GT 630/PCIe/SSE2, 16 GB, SSD 120 GB, Data 1TB
Personal: Lenovo X1 Carbon with MX-23 Fluxbox and Windows 10
Other: Raspberry Pi 5 with MX-23 Xfce Raspberry Pi Respin

User avatar
Adrian
Developer
Posts: 8250
Joined: Wed Jul 12, 2006 1:42 am

Re: Trick: simple server

#4 Post by Adrian »

Jerry3904 wrote:How do you stop it?
CTRL-C in that terminal or in different terminal you can use pkill python (if you don't have any other python script running, because it will kill all the processes named like that).

User avatar
m_pav
Developer
Posts: 1390
Joined: Sun Aug 06, 2006 3:02 pm

Re: Trick: simple server

#5 Post by m_pav »

Nice !!
Mike P

Regd Linux User #472293
(Daily) Lenovo T560, i7-6600U, 16GB, 2.0TB SSD, MX_ahs
(ManCave) AMD FX 6100 CPU, nVidia, 8Gb, 3.25TB mixed, MX_ahs
(Spare)2017 Macbook Air 7,2, 8GB, 256GB SSD, MX_ahs

User avatar
Adrian
Developer
Posts: 8250
Joined: Wed Jul 12, 2006 1:42 am

Re: Trick: simple server

#6 Post by Adrian »

One potential use, a quick way to share something to and from a virtual machine without having to enable folder sharing (some are a bit more complicated to set up, for example in KVM, especially after you started the VM)

Oh, and it even works in Windows 10 (if you have Linux services installed, or probably if you have only Python installed -- yep, just tried, that works)

Post Reply

Return to “Tips & Tricks by users”