Transfering files to and from your workstation

From CUC3
Jump to navigation Jump to search

First off you should only be using programs that use the ssh libraries for transferring files. Furthermore you should not be using a system that allows rcp or rlogin because they send unencrypted passwords.

1. scp is on quick and easy option

The below will transfer a single file TEMP

 scp TEMP  $USER@$REMOTEHOST:~

The directory will recursively transfer an entire directory DIRECTORY

 scp -r DIRECTORY  $USER@$REMOTEHOST:~

2 rsync is a more powerful utility that will send the differences between files or directories; therefore it can be much quicker than scp. Like scp it can transferr files within a filesystem or to remote machines. Rsync can also preserve the permissions of the files and directories. Rsync is ideal for backups as well. Rsync has multiple options so you will need to read the documentation for more details via info rsync.

The directory will recursively transfer an entire directory DIRECTORY

 rsync -Pavu  DIRECTORY  DIRECTORY_1

Only use with ssh.

 rsync -Pavu -e ssh DIRECTORY  $USER@$REMOTEHOST:~

Be very careful of the --delete flag. It does what you think will.

The --exclude-from flag can be helpful when large binaries or databases need not be transferred.

--mp466 01:08, 8 July 2008 (BST)