2

Currently I use a script to put an image on the target server:

dd if=100mb.bin | ssh backup-server "dd of=/home/backupvps/blaa/100mb.bin"

However, how can I retrieve this very same file? I'd rather not use any FTP or Web server, but native commands.

  • 2
    If ssh works, you should be able to use scp. – Max Alginin Mar 14 '12 at 20:01
3

If for some reason scp doesn't work for this purpose, you can simply:

ssh backup-server 'cat /home/backupvps/blaa/100mb.bin' > 100mb.bin
  • Thanks, using this right now! I prefer this over scp as I can pipe it through to lzop. ;-) – Devator Mar 14 '12 at 21:07
  • 1
    You can always use scp -o Compression=yes -o CompressionLevel=9 to get gzip at the transport level. – Daniel Pittman Mar 14 '12 at 21:22
  • @DanielPittman Absolutely. In this case, though, lzop might have some advantages over the built-in gzip capability for certain types of connections, so something like ssh backup-server 'cat somefile | lzop' | lzop -d - > somefile might be very useful. For bonus points, work pv into it somewhere. Similarly, for very small connections with beefy boxen at either end, I've been known to pipe through bzip2/bzcat. – BMDan Mar 15 '12 at 14:36
5

As Max Alginin says, scp should work fine:

scp user@backup-server:/home/backupvps/blaa/100mb.bin /some/location/here/

I'd look into rsync though; uses a delta transfer algorithm, more efficient.

  • rsync will still be slow for the first time. – Shyam Sundar C S Mar 14 '12 at 20:09
1

A lightweight option is to use netcat. ( Illustration )

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.