Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
netcat [2006/08/08 12:50]
a created
netcat [2009/05/25 00:35] (current)
Line 1: Line 1:
-Using netcat and tar to quickly transfer files between machines, aka tar pipe+====== ​Using netcat and tar to quickly transfer files between machines, aka tar pipe ====== 
  
 So you have gigs of data to transfer between two machines over ethernet. A nice quick and dirty method is to use netcat and tar. This is by no means secure, but if you haven'​t got the time or desire to setup NFS, FTPd, Samba. Or wait hours for scp to do it's job then this can save you a lot of time. So you have gigs of data to transfer between two machines over ethernet. A nice quick and dirty method is to use netcat and tar. This is by no means secure, but if you haven'​t got the time or desire to setup NFS, FTPd, Samba. Or wait hours for scp to do it's job then this can save you a lot of time.
-Linux System using tar and netcat+ 
 +===== Linux System using tar and netcat ​===== 
  
 On the receiving end do: On the receiving end do:
-# netcat -l -p 7000 | tar x+   # netcat -l -p 7000 | tar x
  
 And on the sending end do: And on the sending end do:
-# tar cf - * | netcat otherhost 7000+  ​# tar cf - * | netcat otherhost 7000
 Notes Notes
  
 Depending on your hardware you might want to use compression with tar. You'll probably find your hard disk drive is a bottleneck on a fast network. Compression is useless if you can't saturate your network and will probably just slow things down. tar cf - * is copy everything in the current working directory. And your files will be untared at the other end from where you started the listening netcat. It won't be obivous that the operation is finished so you'll need to check network activity or top. This is indeed quick and dirty. Depending on your hardware you might want to use compression with tar. You'll probably find your hard disk drive is a bottleneck on a fast network. Compression is useless if you can't saturate your network and will probably just slow things down. tar cf - * is copy everything in the current working directory. And your files will be untared at the other end from where you started the listening netcat. It won't be obivous that the operation is finished so you'll need to check network activity or top. This is indeed quick and dirty.
-OpenBSD using tar and nc+ 
 +===== OpenBSD using tar and nc =====
  
 OpenBSD usually offers a much tighter system rather than the mess you have with Linux. OpenBSD has it's own verison of netcat just refered as nc. The tar command is less sloppy than what you find in Linux. So if you're using two OpenBSD machines then one would do the following. OpenBSD usually offers a much tighter system rather than the mess you have with Linux. OpenBSD has it's own verison of netcat just refered as nc. The tar command is less sloppy than what you find in Linux. So if you're using two OpenBSD machines then one would do the following.
  
 On the receiving end do: On the receiving end do:
-# nc -l 7000 | tar -xpf -+   # nc -l 7000 | tar -xpf -
  
 And on the sending end do: And on the sending end do:
-# tar -cf - * | nc otherhost 7000 +   # tar -cf - * | nc otherhost 7000 
netcat.txt · Last modified: 2009/05/25 00:35 (external edit)
CC Attribution-Noncommercial-Share Alike 4.0 International
Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0 ipv6 ready