rsync: Remote Sync.
Description: rsync utility is used to synchronize the files and directories from one location to another in an effective way. Backup location could be on local server or on remote server.
Features:
(*).One of the main feature of rsync is that it transfers only the changed block to the destination, instead of sending the whole file.
Syntax:
rsync options source destination (or)
rsync [OPTION]... SRC [SRC]... [USER@]HOST:DEST (or)
rsync [OPTION]... [USER@]HOST:SRC [DEST]
a - Archive same -rptgolD, [Its enough to copy entire folder of file even with out changing file permission]
-r - Recursive [Copy entire directive]
-p, --perms preserve(Unalter) permissions
-t, --times preserve times
-o, --owner preserve owner (super-user only)
-g, --group preserve group
-l, --links copy symlinks as symlinks
-D same as --devices --specials
--devices preserve device files (super-user only)
--specials preserve special files
-z, --compress - Compress file data during the transfer.
-v - verbose, Explain what happen in view
-u - Do Not Overwrite the Modified Files at the Destination [if the file in the destination in modified and if u use -u option in rsync, the modified file wont be overwritten].
--rsh=COMMAND -- specify the remote shell to use. (e.g) --rsh='ssh -p1055' to login to remote system.
--progress - View the rsync Progress during Transfer
--stats - give some file-transfer stats
--delete - This tells rsync to delete extraneous files from the receiving side (ones that aren’t on the sending side), but only for the directories that are being synchronized.
--exclude - This option is used to exclude some certain files
--max-size=SIZE - This tells rsync to avoid transferring any file that is larger than the specified SIZE
--max-size=SIZE - This tells rsync to avoid transferring any file that is smaller than the specified SIZE
Examples:
1.rsync Command to copy only Files from a folder
#rsync -avz doc/ Desktop/welcome/
#ls Desktop/welcome/
taglist.txt
===>taglist.txt is the file present in the folder doc
2.rsync command to copy entire folder to the destination
#rsync -avz doc Desktop/welcome/
#ls Desktop/welcome/
doc
===>doc is the folder we copied.
3.rsync command with --progress option
#rsync -avz --progress doc Desktop/welcome/
building file list ...
2 files to consider
doc/
doc/taglist.txt
69366 100% 11.63MB/s 0:00:00 (xfer#1, to-check=0/2)
sent 18509 bytes received 48 bytes 37114.00 bytes/sec
total size is 69366 speedup is 3.74
===> --progress option gives you a progress meter of data send to the destination.
4.rsync command with --progress and --stats options
#rsync -avz --progress --stats doc Desktop/welcome/
building file list ...
2 files to consider
doc/
doc/taglist.txt
69366 100% 11.63MB/s 0:00:00 (xfer#1, to-check=0/2)
Number of files: 2
Number of files transferred: 1
Total file size: 69366 bytes
Total transferred file size: 69366 bytes
Literal data: 69366 bytes
Matched data: 0 bytes
File list size: 83
File list generation time: 0.001 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 18509
Total bytes received: 48
sent 18509 bytes received 48 bytes 37114.00 bytes/sec
total size is 69366 speedup is 3.74
===> --stats option tells you a status information of file transfered.
5.rsync command with --delete option
#cd Desktop/welcome/
#cat > hi
#hello
#rsync -avz --delete doc Desktop/welcome/
building file list ... done
deleting doc/hi
doc/
sent 105 bytes received 26 bytes 262.00 bytes/sec
total size is 69366 speedup is 529.51
===> --delete command is used to delete files in the destination if the source doesn't have the file.
#cd Desktop/welcome/
#ls
taglist.txt
6.rsync command with --exclude option.
#cd doc
#cat hello
this is hello file
#rsync -avz --exclude doc/hi doc Desktop/welcome/
building file list ... done
doc/
sent 105 bytes received 26 bytes 262.00 bytes/sec
total size is 69366 speedup is 529.51
#cd Desktop/welcome/
#ls
taglist.txt
7.rsync command to transfer file from Source system to Destination system.
#rsync -avz --progress --stats --delete --rsh='ssh -Xp36985' doc rajm@192.168.1.5:Desktop/
===> The above command is used to copy file from source system to Desktop of destination system .
8.rsync command to transfer file from destination system to source system.
#rsync -avz --progress --stats --rsh='ssh -Xp36985' rajm@192.168.1.5:Desktop/doc .
===> The above command is used to copy files from Desktop system to source of destination system .
Description: rsync utility is used to synchronize the files and directories from one location to another in an effective way. Backup location could be on local server or on remote server.
Features:
(*).One of the main feature of rsync is that it transfers only the changed block to the destination, instead of sending the whole file.
Syntax:
rsync options source destination (or)
rsync [OPTION]... SRC [SRC]... [USER@]HOST:DEST (or)
rsync [OPTION]... [USER@]HOST:SRC [DEST]
a - Archive same -rptgolD, [Its enough to copy entire folder of file even with out changing file permission]
-r - Recursive [Copy entire directive]
-p, --perms preserve(Unalter) permissions
-t, --times preserve times
-o, --owner preserve owner (super-user only)
-g, --group preserve group
-l, --links copy symlinks as symlinks
-D same as --devices --specials
--devices preserve device files (super-user only)
--specials preserve special files
-z, --compress - Compress file data during the transfer.
-v - verbose, Explain what happen in view
-u - Do Not Overwrite the Modified Files at the Destination [if the file in the destination in modified and if u use -u option in rsync, the modified file wont be overwritten].
--rsh=COMMAND -- specify the remote shell to use. (e.g) --rsh='ssh -p1055' to login to remote system.
--progress - View the rsync Progress during Transfer
--stats - give some file-transfer stats
--delete - This tells rsync to delete extraneous files from the receiving side (ones that aren’t on the sending side), but only for the directories that are being synchronized.
--exclude - This option is used to exclude some certain files
--max-size=SIZE - This tells rsync to avoid transferring any file that is larger than the specified SIZE
--max-size=SIZE - This tells rsync to avoid transferring any file that is smaller than the specified SIZE
Examples:
1.rsync Command to copy only Files from a folder
#rsync -avz doc/ Desktop/welcome/
#ls Desktop/welcome/
taglist.txt
===>taglist.txt is the file present in the folder doc
2.rsync command to copy entire folder to the destination
#rsync -avz doc Desktop/welcome/
#ls Desktop/welcome/
doc
===>doc is the folder we copied.
3.rsync command with --progress option
#rsync -avz --progress doc Desktop/welcome/
building file list ...
2 files to consider
doc/
doc/taglist.txt
69366 100% 11.63MB/s 0:00:00 (xfer#1, to-check=0/2)
sent 18509 bytes received 48 bytes 37114.00 bytes/sec
total size is 69366 speedup is 3.74
===> --progress option gives you a progress meter of data send to the destination.
4.rsync command with --progress and --stats options
#rsync -avz --progress --stats doc Desktop/welcome/
building file list ...
2 files to consider
doc/
doc/taglist.txt
69366 100% 11.63MB/s 0:00:00 (xfer#1, to-check=0/2)
Number of files: 2
Number of files transferred: 1
Total file size: 69366 bytes
Total transferred file size: 69366 bytes
Literal data: 69366 bytes
Matched data: 0 bytes
File list size: 83
File list generation time: 0.001 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 18509
Total bytes received: 48
sent 18509 bytes received 48 bytes 37114.00 bytes/sec
total size is 69366 speedup is 3.74
===> --stats option tells you a status information of file transfered.
5.rsync command with --delete option
#cd Desktop/welcome/
#cat > hi
#hello
#rsync -avz --delete doc Desktop/welcome/
building file list ... done
deleting doc/hi
doc/
sent 105 bytes received 26 bytes 262.00 bytes/sec
total size is 69366 speedup is 529.51
===> --delete command is used to delete files in the destination if the source doesn't have the file.
#cd Desktop/welcome/
#ls
taglist.txt
6.rsync command with --exclude option.
#cd doc
#cat hello
this is hello file
#rsync -avz --exclude doc/hi doc Desktop/welcome/
building file list ... done
doc/
sent 105 bytes received 26 bytes 262.00 bytes/sec
total size is 69366 speedup is 529.51
#cd Desktop/welcome/
#ls
taglist.txt
7.rsync command to transfer file from Source system to Destination system.
#rsync -avz --progress --stats --delete --rsh='ssh -Xp36985' doc rajm@192.168.1.5:Desktop/
===> The above command is used to copy file from source system to Desktop of destination system .
8.rsync command to transfer file from destination system to source system.
#rsync -avz --progress --stats --rsh='ssh -Xp36985' rajm@192.168.1.5:Desktop/doc .
===> The above command is used to copy files from Desktop system to source of destination system .