Copy files to remote server

From vpsget wiki
Jump to: navigation, search

How to copy files to remote server using command line

1. Rsync. We are assuming that the ssh keys are already configured.

rsync -av -e 'ssh -p22' /path/to/file IP:/path

2. Scp

scp -P 22 /path/to/file username@remoteserver.tld:/path/to/remote/directory/

Add -r for recursive (copy all directory with subdirs):

scp -r -P 22 /path/to/file username@remoteserver.tld:/path/to/remote/directory/

If you wan to resume broken scp transfer try with rsync:

rsync --append-verify --progress --rsh="ssh -p 4567" me@localhost:/path/to/large/file.gz 

Better next time use rsync from beginning :)

rsync --partial --progress --rsh=ssh user@host:remote_file local_file

or

rsync -avz -e ssh remoteuser@remotehost:/remote/path /local/path