rsync
Pull files from your VPS
rsync command to pull files from your VPS to your local machine with an overall progress bar:
rsync -avzh --info=progress2 user@vps_ip:/path/to/remote/dir/ /path/to/local/dir/
Key Flag Breakdown
| Flag | Description |
|---|---|
-a (archive) |
Preserves file permissions, ownership, timestamps, and symlinks recursively. |
-v (verbose) |
Displays transfer details in the terminal. |
-z (compress) |
Compresses data during transfer to save bandwidth and speed up overall transfer. |
-h (human-readable) |
Displays file sizes and speeds in KB, MB, or GB instead of raw bytes. |
--info=progress2 |
Shows a single overall progress bar (total percentage, speed, and ETA) for the entire sync operation rather than file-by-file. |
Common Modifications
1. Keep partially transferred files (if connection drops)
If your transfer gets interrupted, use -P (which combines --progress and --partial to resume interrupted files):
rsync -avzhP user@vps_ip:/path/to/remote/dir/ /path/to/local/dir/
2. Custom SSH Port or SSH Key
If your VPS uses a non-standard SSH port (e.g., 2222) or a specific private key:
rsync -avzh --info=progress2 -e "ssh -p 2222 -i ~/.ssh/id_rsa" user@vps_ip:/remote/dir/ /local/dir/