Stream a directory over SSH

Copy a tree without a temporary archive and keep permissions. Add zstd to the pipe on slow links

tar c -C /src . | ssh user@<host> 'tar x -C /dst'

tool
tar3 commands
tags
tarnetworktroubleshooting

More tar commands

  • tar cf - /data | pv -s $(du -sb /data | awk '{print $1}') | zstd -T0 > data.tar.zst

    pv shows bytes and ETA while data streams into zstd. du -sb gives the total size for the bar

  • tar -czg snapshot.snar -f backup-$(date +%F).tgz /data

    Incremental backups by level: snapshot.snar keeps the state, so only changed files go into the archive

all 3 tar commands