MobaXterm is a beautiful tool for every DevOps engineer for having a local bash terminal and remote terminals and RDP. Today let us explore the rsync command with mobaxterm bash terminal to copy or sync files. rsync is available by default in MobaXterm.
What is the Rsync command?
rsync in a nutshell is a utility for efficiently transferring and synchronizing files between a computer and a storage drive and across networked computers by comparing the modification times and sizes of files (reference: rsync Wikipedia)
Basic Syntax to copy files from one location to another using Rsync
The rsync command can be used in different situations and conditions, the basic syntax is simple as:
rsync <swithces> source-location destination-location
Switches are the command line parameters you can input to the rsync command, which control the behavior of how rsync handles that invocation. Next, let’s go with an example of how to use the rsync command in MobaXterm.
How to use the rsync command in MobaXterm local bash terminal?
Let us have two directories, named source, and destination:
[[email protected] test]$ ls -l total 0 drwxrwxr-x 2 admin admin 6 Nov 2 04:49 destination drwxrwxr-x 2 admin admin 159 Oct 25 01:19 source
The source directory has a few files in it,
[[email protected] test]$ ls source/ file1.txt file2.txt file3.txt file4.txt file5.txt file6.txt file7.txt file8.txt file9.txt Destination directory is empty. [[email protected] test]$ ls destination/ [[email protected] test]$
Let us sync files from source to destination directory using rsync
[[email protected] test]$ rsync -av source/ destination/ sending incremental file list ./ file1.txt file2.txt file3.txt file4.txt file5.txt file6.txt file7.txt file8.txt file9.txt sent 568 bytes received 190 bytes 1,516.00 bytes/sec total size is 0 speedup is 0.00 We used rsync with v, so it is showing verbose details.
Verifying the destination after rsync
[[email protected] test]$ ls destination/ file1.txt file2.txt file3.txt file4.txt file5.txt file6.txt file7.txt file8.txt file9.txt
This example illustrates how locally you can use the rsync command within the MobaXterm bash shell. Are you looking for more tips and tricks, configuration ideas, problems, solutions with practical examples for MobaXterm, please check our section: MobaXterm tips and tricks