# Using tar and SSH as an alternative to rsync for transferring files

DevFeed: [Using tar and SSH as an alternative to rsync for transferring files](<https://devfeed.tech/articles/tar-a-slop-free-alternative-to-rsync-20818.md>)

Original publisher: [Read original article](<https://drewdevault.com/blog/rsync-without-rsync/>)

Author: March

Published: 2026-03-28T00:00:00Z

Content type: tutorial

Language: en

Sources: [Drew DeVault](<https://devfeed.tech/sources/drew-devault.md>)

Topics: [rsync](<https://devfeed.tech/topics/rsync.md>), [Command-line interface](<https://devfeed.tech/topics/cli.md>), [ssh](<https://devfeed.tech/topics/ssh.md>), [Compression](<https://devfeed.tech/topics/compression.md>)

Tags: [command-line](<https://devfeed.tech/tags/command-line.md>), [compression](<https://devfeed.tech/tags/compression.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [rsync](<https://devfeed.tech/tags/rsync.md>), [ssh](<https://devfeed.tech/tags/ssh.md>)

## AI overview

The article explains how to use tar piped through SSH to transfer files to another host, preserving ownership and permissions while using gzip compression. It notes that tar does not identify and skip files that are already up to date, unlike rsync, and presents basic tar options and an optional progress display with pv.

## Source excerpt

So apparently rsync is slop now. When I heard, I wanted to drop a quick note on my blog to give an alternative: tar. It doesn't do everything that rsync does, in particular identifying and skipping up-to-date files, but tar + ssh can definitely accomodate the use case of "transmit all of these files over an SSH connection to another host". Consider the following: tar -cz public | ssh example.org tar -C /var/www -xz This will transfer the contents of ./public/ to example.org:/var/www/public/, preserving file ownership and permissions and so on, with gzip compression. This is roughly the equivalent of: rsync -a public example.org:/var/www/ Here's the same thing with a lightweight progress display thanks to pv: tar -cz public | pv | ssh example.org tar -C /var/www -xz I know tar is infamously difficult to remember how to use. Honestly, I kind of feel that way about rsync, too. But, here's a refresher on the most important options for this use-case. To use tar, pick one of the following modes with the command line flags: -c: create an archive -x: extract an archive Use -f <filename> to read from or write to a file. Without this option, tar uses stdin and stdout, which is what the pipelines above rely on. Use -C <path> to change directories before archiving or extracting files. Use -z to compress or decompress the tarball with gzip. That's basically everything you need to know about tar to use it for this purpose (and for most purposes, really). With rsync, to control where the files end up you have to memorize some rules about things like whether or not each path has a trailing slash. With tar, the rules are, in my opinion, a bit easier to reason about. The paths which appear on the command line of tar -c are the paths that tar -x will open to create those files. So if you run this: tar -c public/index.html public/index.css You get a tarball which has public/index.html and public/index.css in it. When tar -x opens this tarball, it will call fopen("public/index.html", "w