Copy files between Linux machines

The rsync command allows you to copy files using SSH connection, between your workstation and another Linux machine. You have to be logged into one of the machines, this command cannot copy files between two remote machines.

To copy a file from a remote server to your local workstation, execute

rsync -avz -e "ssh -i SSH_KEY_NAME" USER_NAME@SOURCE_IP:/SOURCE_DIRECTORY/SOURCE_FILE_NAME TARGET_DIRECTORY

To copy a file to a remote server, swap the source and target definitions after the SSH_KEY_NAME option.

Leave a Reply