This is very useful Ruby command to share your local folder with everyone on the same network.

Thanks to Rohan! As we were working on something and he wanted me to share my local folder quickly.

Rohan shared this Ruby command with me and since then every now and then I am using it in office to share stuff with teams. Command is:

ruby -rwebrick -e 'WEBrick::HTTPServer.new(:Port=>PORT_NUMBER,:DocumentRoot=>”DIRECTORY_PATH").start'
e.g.
  ruby -rwebrick -e 'WEBrick::HTTPServer.new(:Port=>2121,:DocumentRoot=>”/home/public/picture").start'

PORT_NUMBER - Port to listen a request

DIRECTORY_PATH - Root Path of the server file

Then check your ip address using command

ifconfig
e.g.
> ifconfig
  inet 192.161.2.1 netmask 0xffffff00 broadcast 192.161.2.255

Now you are all set and can share url -> http://your_ip_address:PORT_NUMBER

e.g.
  For above mentioned sample url will be http://192.161.2.1:2121