Overview
Transferring files between your Breezes or from an external server is a fundamental task. This guide covers the most reliable and efficient methods for different scenarios.
Method 1: SCP (Simple Copies)
Best for quick, one-off transfers of individual files or directories:
# Single file
scp /path/to/file.tar.gz root@remote-ip:/destination/
# Entire directory
scp -r /var/www/html root@remote-ip:/var/www/Method 2: Rsync (Large or Incremental Transfers)
Best for large transfers, syncing directories, or resuming interrupted transfers:
# Sync with compression and progress
rsync -avzP /var/www/html/ root@remote-ip:/var/www/html/
# Exclude specific files or directories
rsync -avzP --exclude='node_modules' --exclude='.git' \
/opt/myapp/ root@remote-ip:/opt/myapp/
# Dry run to preview changes
rsync -avzPn /source/ root@remote-ip:/destination/Method 3: tar over SSH (Preserving Permissions)
Ideal when you need to preserve exact ownership and permissions:
tar czf - /var/www/html | ssh root@remote-ip "tar xzf - -C /"Method 4: SFTP (Interactive Browsing)
sftp root@remote-ip
sftp> put localfile.tar.gz /remote/path/
sftp> get /remote/path/file.tar.gz
sftp> byeSpeed Tips
- Use
rsync -avzPfor resumable transfers over slow connections - Use
tarpiped through SSH for many small files (avoids per-file overhead) - Add
-e "ssh -c aes128-ctr"for faster encryption on trusted networks - Use
screenortmuxfor long transfers to survive disconnections
Verify Transfers
# Compare file counts
find /source -type f | wc -l
ssh root@remote-ip "find /destination -type f | wc -l"
# Compare checksums
md5sum largefile.tar.gz
ssh root@remote-ip "md5sum /path/largefile.tar.gz"