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.

1
  • 2
    If ssh works, you should be able to use scp. Mar 14, 2012 at 20:01

3 Answers 3

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
3
  • Thanks, using this right now! I prefer this over scp as I can pipe it through to lzop. ;-)
    – Devator
    Mar 14, 2012 at 21:07
  • 1
    You can always use scp -o Compression=yes -o CompressionLevel=9 to get gzip at the transport level. Mar 14, 2012 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, 2012 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.

1
  • rsync will still be slow for the first time. Mar 14, 2012 at 20:09
1

A lightweight option is to use netcat. ( Illustration )

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .