rdaemon

View on GitHub
15 February 2019

Transfer files between nix based machines

by Mallikarjun

Overview

  1. Transfer files using netcat
  2. Transfer files using python simplehttpserver
  3. References

Transfer files using netcat

Consider you have a file /tmp/mini.iso. You want to transfer from your machine to 10.0.0.11

Start netcat server on destination machine listening on 5555 output to destination file

[~] ➜ nc -l -p 5555 > /tmp/mini.iso

Send file from source machine to the port on which destination machine is listening on

[~] ➜ cat /tmp/mini.iso | pv | nc 10.0.0.11 5555

OR

[~] ➜ nc 10.0.0.11 5555 < /tmp/mini.iso

» nc – arbitrary TCP and UDP connections and listens

» pv – monitor the progress of data through a pipe

» cat – concatenate files and print on the standard output

» -l – listen on specified port

» -p – port to be listened on

Transfer files using python simplehttpserver

Consider you have a file /tmp/mini.iso. You want to transfer from your machine to 10.0.0.11

Start python simple httpserver on the source machine listening on 5555 from the folder in which your file is placed

[~] ➜ ls
photo-1525249181835

[~] ➜ python -m SimpleHTTPServer 5555

On destination machine, open the browser and visit link http://10.0.0.11:5555/. You should see following information. Then you can download from the same

Directory listing for /
photo-1525249181835

References

» Linux Man pages

» Netcat Man pages

» PV Man pages

tags: scp - nc - rsync - files - linux