Share files over devices under same network - Linux

First, Make sure you have python installed in your machine. If not, follow these instructions to install python
sudo apt-get install libssl-dev openssl

wget https://www.python.org/ftp/python/3.4.1/Python-3.4.1.tgz

tar -xvf Python-3.4.1.tgz

cd Python-3.4.1/

./configure

make

sudo make install

./python
(source: http://www.sysads.co.uk/2014/06/install-python-3-4-1-ubuntu-14-04/)

Now just follow below 3 steps to create your own file server with one command

1. Create a shell script file with the following content 

e.g.: shareThis.sh

#!/bin/bash
ipaddress=$(ifconfig | grep -A 1 wlan0 | grep 'inet' | sed s/:/' '/ |awk '{print $3}')
echo 'Access any file from location '$PWD' on http://'$ipaddress':8000'
python -m SimpleHTTPServer > /dev/null 2>&1 

Actually this is all you need. Now run the shell script e.g., 
sh shareThis.sh 
In whichever directory you want. 

2. Make an executable command for the same. 
Give full permission to the file.
chmod +x shareThis.sh 

Now you can run it by just typing ./shareThis.sh 

3. Create an alias. 
Alias helps you to run this script just like you run any other command on Linux

Open .bashrc file.
vi ~/.bashrc

At the end of this file, add this line
alias shareThis='~/shareThis.sh'

Source bash file to get immediate effect

source  ~/.bashrc

That's it. Now whenever you want to share files among other devices in your network, just run the command 'shareThis'

3 comments: Leave Your Comments

  1. Really an amazing post..! By reading your blog post I gathered more information. I really appreciate your news about how to share a files over device under same network in linux. Thanks a lot for posting individual information and made me more knowledgeable person. I hope it will be very helpful for all. I don't have words to describe this blog. Keep on blogging!!
    Engineering Colleges, Mechanical Engineering Colleges in Chennai

    ReplyDelete
  2. I’ve been browsing on-line greater than three hours today, but I never discovered any attention-grabbing article like yours. It is

    beautiful worth sufficient for me. Personally, if all webmasters and bloggers made good content material as you did, the net will

    be a lot more helpful than ever before.
    AWS Training in Chennai

    ReplyDelete
  3. this is very nice post thanks for updating your information to us.it is such a wonderful information about the software development and java is one of growing technology this is useful for me thank you so much.

    MSBI Training in Chennai

    ReplyDelete