Let’s say you have a bunch of files that need backed up - who doesn’t these days?
With big files, and especially transferring files over the internet, that is a big deal.
The above command would send your files to another computer with an IP address of 10.1.1.1.
- If you’re using the
switch, you’ll definitely want to use this one as well.
That is, unless you like to convert bytes to megabytes on the fly.
- This switch is essential to know when you’re first writing your rsync script and testing it out.
- This switch must be used if the destination directory doesn’t already exist.
It just needs a plain text file with a directory or file path on each line.
- This lets you send the rsync output to a log file.
We definitely recommend this for automated backups in which you aren’t there to read through the output yourself.
Always give log files a once over in your spare time to see to it everything is working properly.
The creator of rsync realized this, and added the
arguments so users could run differential backups.
Snapshot backups to the rescue!
Pretend we have a backup script running that automatically backs up our data every two hours.
Whenever rsync does this, it names each backup in the format of: Backup-month-day-year-time.
Yet, there would be no duplicates across any two directories.
rsync accomplishes this with the use of hardlinking through the
argument.
The yes pipe is to confirm that we want to overwrite the file.
Next, we take the current time and put it into time.txt.
These files will come in handy later.
- These are the permissions for the destination directory.
Finally, we double-check that a copy of the log file is placed inside the backup.
We use secure copy on port 12345 to take the rsync log and place it in the proper directory.
Automation
UseCron on LinuxorTask Scheduler on Windowsto automate your rsync script.
We finally have a fantastic (and free!)
backup solution in place, but all of our files are still susceptible to theft.
Hopefully, you’re backing up your files to some place hundreds of miles away.
No matter how secure that faraway place is, theft and hacking can always be problems.
However, we need to see to it the destination is just as secure.
One of rsync’s best features is that it only transfers the changes in each file.
Linux Commands
Files
tarpvcattacchmodgrepdiffsedarmanpushdpopdfscktestdiskseqfdpandoccd$PATHawkjoinjqfolduniqjournalctltailstatlsfstabecholesschgrpchownrevlookstringstyperenamezipunzipmountumountinstallfdiskmkfsrmrmdirrsyncdfgpgvinanomkdirdulnpatchconvertrcloneshredsrmscpgzipchattrcutfindumaskwctr
Processes
aliasscreentopnicereniceprogressstracesystemdtmuxchshhistoryatbatchfreewhichdmesgchfnusermodpschrootxargsttypinkylsofvmstattimeoutwallyeskillsleepsudosutimegroupaddusermodgroupslshwshutdownreboothaltpoweroffpasswdlscpucrontabdatebgfgpidofnohuppmap
Networking
netstatpingtracerouteipsswhoisfail2banbmondigfingernmapftpcurlwgetwhowhoamiwiptablesssh-keygenufwarpingfirewalld