Replace scp with rsync: Reliable File Transfers and Resume Support
This guide explains why rsync outperforms scp for file copying, shows how to install it on various Linux and macOS systems, and demonstrates command options—including compression, partial transfers, and SSH tunneling—to reliably resume interrupted transfers.
What Is rsync?
Rsync is a fast, highly flexible file‑copy tool that works locally, over any remote shell (such as SSH), or via a dedicated rsync daemon. It uses an incremental transfer algorithm that sends only the differences between source and destination files, dramatically reducing network traffic. The default "quick‑check" algorithm compares file size and modification time to decide what needs updating.
Supported Platforms
Rsync runs on any Unix‑like system, including Linux and macOS. There are also ports for Windows, though they are less common.
Installation
On Debian‑based distributions (Ubuntu, etc.) use: sudo apt install rsync On RedHat‑based systems (RHEL, CentOS, Fedora) use: sudo yum install rsync On macOS with Homebrew: brew install rsync Verify the installation with:
rsync --versionBasic Usage
Copy a file from the local host to a remote host (similar to scp) while adding useful options:
rsync -partial -z -e 'ssh -p 22' linuxmi.cpp [email protected]:/home/linuxmiExplanation of the options: -e 'ssh -p 22' – Use SSH on port 22 for the connection. -z – Compress data during transfer to speed up the copy. -partial – Keep partially transferred files so that an interrupted transfer can be resumed. Without this flag, rsync deletes incomplete files.
Resuming Interrupted Transfers
If a transfer is stopped after using -partial, simply re‑run the same command. Rsync will detect the existing partial file and continue copying from where it left off, effectively “magically” resuming the transfer.
Conclusion
Rsync offers many powerful options beyond basic copying, such as bandwidth limiting, exclusion patterns, and more. The most critical feature for reliable transfers is the ability to resume interrupted copies using -partial. Use the commands above to replace scp with rsync for safer, faster file synchronization.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Liangxu Linux
Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
