4 ms·
$ tar cf - foo bar | ssh user@host tar -C baz -xvf -
by mzs 5y ago
$ tar cf - foo bar | ssh user@host tar -C baz -xvf -
- chasil 5y agoThat can bite you if the remote tar allows absolute paths.
- loxias 5y agohigh five It truly is the best, no? My pipelines look a bit different than yours (they usually have `lzop`/`zstd`, `cd`, and occasionally `pv`), but tar truly is the best file copy utility. I rarely use `cp -a` even when copying locally. `tar` is so much faster.
- technofiend 5y agoI use this locally as well, simply because I know and prefer tar's behavior to that of cp. For example tar cf - . | (cd /some/where/else; tar xvf -). It's possible to do this using cpio as well but it always seemed like cpio needed so many more switches to do the same thing.