Find us on social media
SCPSFTPFiles5 min read
Transfer files with SCP and SFTP
Transfer files between your local machine and VPS securely using SCP, SFTP, and rsync.
SCP and SFTP are secure methods to transfer files between your local machine and your VPS over SSH.
SCP — Secure Copy
SCP copies files over SSH in a single command.
Upload a file to the VPS
bash
scp localfile.txt deploy@YOUR_VPS_IP:/home/deploy/Download a file from the VPS
bash
scp deploy@YOUR_VPS_IP:/home/deploy/remotefile.txt ./Upload a directory (recursive)
bash
scp -r ./myproject deploy@YOUR_VPS_IP:/home/deploy/Download a directory
bash
scp -r deploy@YOUR_VPS_IP:/home/deploy/myproject ./Use a custom SSH port
bash
scp -P 2222 localfile.txt deploy@YOUR_VPS_IP:/home/deploy/SFTP — SSH File Transfer Protocol
SFTP provides an interactive file transfer session.
Connect
bash
sftp deploy@YOUR_VPS_IPSFTP commands
bash
ls # List remote files
lls # List local files
cd /var/www # Change remote directory
lcd ~/Desktop # Change local directory
put file.txt # Upload file
get file.txt # Download file
mput *.html # Upload multiple files
mget *.log # Download multiple files
mkdir newdir # Create remote directory
rm file.txt # Delete remote file
exit # Close sessionrsync — Efficient synchronization
rsync only transfers changed files, making it ideal for deployments:
bash
# Sync local directory to VPS
rsync -avz --progress ./dist/ deploy@YOUR_VPS_IP:/var/www/mysite/
# Sync with delete (mirror)
rsync -avz --delete ./dist/ deploy@YOUR_VPS_IP:/var/www/mysite/
# Exclude files
rsync -avz --exclude 'node_modules' --exclude '.git' ./ deploy@YOUR_VPS_IP:/home/deploy/myapp/GUI clients
If you prefer a graphical interface:
- FileZilla (cross-platform) — connect with SFTP protocol
- WinSCP (Windows) — native SCP/SFTP client
- Cyberduck (macOS) — supports SFTP
Tip
For automated deployments, use rsync with SSH keys (no password prompts). Combine with a deployment script or CI/CD pipeline for consistent releases to your Baires Host VPS.
Was this guide helpful?