Using rsync
The rsync command is used to copy files from one place to another on unix-like systems.
To copy a directory do the following:
rsync -avz --delete /path/to/source/dir /path/to/destination/dir
The -a option is used to copy all files and directories recursively. The -v option is used to show what is happening. The -z option is used to compress the data. The --delete option is used to delete files that are not in the source directory.
Backing up to a USB drive
A good use for the rsync command is to backup files to a USB drive. To list the available drives on a unix-like system do the following:
mount
From there, you can use the rsync command to copy files to the USB drive.
Copying files to a remote server
You can also use rsync to copy files to a remote server. To do this, you need to know the IP address of the remote server. You will also need to know the username and password of the remote server. Alternatively, you can use the ssh command to connect to the remote server and then use the rsync command to copy files.
The rsync command to copy files to a server might look like this:
rsync -a /home/www/images/ username@11.11.11.11:/var/www/images/
Note: The username would be the username of the user on the remote server. The IP address would be the IP address of the remote server.