Tux

...making Linux just a little more fun!

2-cent Tip: 'Serve' your current directory

Amit Saha [amitsaha.in at gmail.com]


Thu, 2 Apr 2009 14:57:59 +0530

Hello all,

Perhaps this is too simple to be a 2c-tip, but still a tip. :)

The following script (either run by hand) or in a script starts up a HTTP server and makes available all the files and directories from which it is started, so as to make them available over the network:

python -m SimpleHTTPServer &

By default, it starts off the server on '8000' but that can be changed using:

python -m SimpleHTTPServer 9090, which starts the server on 9090, and can be accessed via the browser or any HTTP client using:

firefox http://127.0.0.1:8000/

More on the Python module at http://docs.python.org/library/simplehttpserver.html

Thanks, Amit

-- 
http://amitksaha.blogspot.com
http://amitsaha.in.googlepages.com/
*Bangalore Open Java Users Group*:http:www.bojug.in
 
"Recursion is the basic iteration mechanism in Scheme"
--- http://c2.com/cgi/wiki?TailRecursion


Top    Back


Thomas Adam [thomas.adam22 at gmail.com]


Thu, 2 Apr 2009 14:54:58 +0100

2009/4/2 Amit Saha <[email protected]>:

> Hello all,
>
> Perhaps this is too simple to be a 2c-tip, but still a tip. :)
>
> The following script (either run by hand) or in a script starts up a
> HTTP server and makes available all the files and directories from
> which it is started, so as to make them available over the network:

So this is exactly the same as WEBrick in Ruby then.

-- Thomas Adam


Top    Back


Amit Saha [amitsaha.in at gmail.com]


Thu, 2 Apr 2009 20:17:23 +0530

On Thu, Apr 2, 2009 at 7:24 PM, Thomas Adam <[email protected]> wrote:

> 2009/4/2 Amit Saha <[email protected]>:
>> Hello all,
>>
>> Perhaps this is too simple to be a 2c-tip, but still a tip. :)
>>
>> The following script (either run by hand) or in a script starts up a
>> HTTP server and makes available all the files and directories from
>> which it is started, so as to make them available over the network:
>
> So this is exactly the same as WEBrick in Ruby then.

Looks like it.

-Amit

-- 
http://amitksaha.blogspot.com
http://amitsaha.in.googlepages.com/
*Bangalore Open Java Users Group*:http:www.bojug.in
 
"Recursion is the basic iteration mechanism in Scheme"
--- http://c2.com/cgi/wiki?TailRecursion


Top    Back


Mulyadi Santosa [mulyadi.santosa at gmail.com]


Wed, 8 Apr 2009 12:20:05 +0700

On Thu, Apr 2, 2009 at 4:27 PM, Amit Saha <[email protected]> wrote:

> Hello all,
>
> Perhaps this is too simple to be a 2c-tip, but still a tip. :)
>
> The following script (either run by hand) or in a script starts up a
> HTTP server and makes available all the files and directories from
> which it is started, so as to make them available over the network:
>
> python -m SimpleHTTPServer &
>
> By default, it starts off the server on '8000' but that can be changed using:
>
> python -m SimpleHTTPServer 9090, which starts the server on 9090, and
> can be accessed via the browser or any HTTP client using:
>
> firefox http://127.0.0.1:8000/
>
> More on the Python module at
> http://docs.python.org/library/simplehttpserver.html

Neat! Anyway, no offense, I've seen a similar tip at http://www.commandlinefu.com. Are you inspired from that site or did you post there too?

regards,

Mulyadi.


Top    Back


Amit Saha [amitsaha.in at gmail.com]


Wed, 8 Apr 2009 11:00:02 +0530

On Wed, Apr 8, 2009 at 10:50 AM, Mulyadi Santosa <[email protected]> wrote:

> On Thu, Apr 2, 2009 at 4:27 PM, Amit Saha <[email protected]> wrote:
>> Hello all,
>>
>> Perhaps this is too simple to be a 2c-tip, but still a tip. :)
>>
>> The following script (either run by hand) or in a script starts up a
>> HTTP server and makes available all the files and directories from
>> which it is started, so as to make them available over the network:
>>
>> python -m SimpleHTTPServer &
>>
>> By default, it starts off the server on '8000' but that can be changed using:
>>
>> python -m SimpleHTTPServer 9090, which starts the server on 9090, and
>> can be accessed via the browser or any HTTP client using:
>>
>> firefox http://127.0.0.1:8000/
>>
>> More on the Python module at
>> http://docs.python.org/library/simplehttpserver.html
>
> Neat! Anyway, no offense, I've seen a similar tip at
> http://www.commandlinefu.com. Are you inspired from that site or did
> you post there too?

I am wholly inspired by that tip :)

-Amit

-- 
http://amitksaha.blogspot.com
http://amitsaha.in.googlepages.com/
*Bangalore Open Java Users Group*:http:www.bojug.in
 
"Recursion is the basic iteration mechanism in Scheme"
--- http://c2.com/cgi/wiki?TailRecursion


Top    Back


Ben Okopnik [ben at linuxgazette.net]


Wed, 8 Apr 2009 08:46:43 -0400

On Wed, Apr 08, 2009 at 11:00:02AM +0530, Amit Saha wrote:

> On Wed, Apr 8, 2009 at 10:50 AM, Mulyadi Santosa
> <[email protected]> wrote:
> >
> > Neat! Anyway, no offense, I've seen a similar tip at
> > http://www.commandlinefu.com. Are you inspired from that site or did
> > you post there too?
> 
> I am wholly inspired by that tip :)

Amit, you really should give credit when you do something like that. We've had a few rough spots here in that regard, and it would be a good idea to take a little extra care to avoid problems in the future.

-- 
* Ben Okopnik * Editor-in-Chief, Linux Gazette * http://LinuxGazette.NET *


Top    Back


Amit Saha [amitsaha.in at gmail.com]


Wed, 8 Apr 2009 22:15:53 +0530

On Wed, Apr 8, 2009 at 6:16 PM, Ben Okopnik <[email protected]> wrote:

> On Wed, Apr 08, 2009 at 11:00:02AM +0530, Amit Saha wrote:
>> On Wed, Apr 8, 2009 at 10:50 AM, Mulyadi Santosa
>> <[email protected]> wrote:
>> >
>> > Neat! Anyway, no offense, I've seen a similar tip at
>> > http://www.commandlinefu.com. Are you inspired from that site or did
>> > you post there too?
>>
>> I am wholly inspired by that tip :)
>
> Amit, you really should give credit when you do something like that.
> We've had a few rough spots here in that regard, and it would be a good
> idea to take a little extra care to avoid problems in the future.

Alright, Thanks for pointing that.

-Amit

-- 
http://amitksaha.blogspot.com
http://amitsaha.in.googlepages.com/
*Bangalore Open Java Users Group*:http:www.bojug.in
 
"Recursion is the basic iteration mechanism in Scheme"
--- http://c2.com/cgi/wiki?TailRecursion


Top    Back