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'

7 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. The blog is absolutely truly incredible. Lots of large information and inspiration, both of which we all need.


    Bangalore Web Designing Company, Web Development Company Bangalore

    ReplyDelete
  3. 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
  4. Its a wonderful post and very helpful, thanks for all this information. You are including better information regarding this topic in an effective way.Thank you so much

    Installment Loans Near Me
    Title loans Near Me
    Cash Advances Near Me

    ReplyDelete
  5. 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
  6. Its really an Excellent post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog. posts. I hope you post again soon.

    Selenium Training in Chennai

    ReplyDelete
  7. There will always be winners and losers, and I think many of these probably do have quite a diverse range of material, with a common thread running through them. This is how I think of Oracle Code, a diverse collection of subjects loosely woven together by an Oracle thread.
    Oracle SQL/PLSQL course

    ReplyDelete