First, we need to install/update the rsync client.

The command on Debian/Ubuntu.

If rsync finds that Directory2 has a file that Directory1 does not, it will delete it.

How to Use rsync to Backup Your Data on Linux

Here is what the aforementioned code tells rsync to do with the backups:

1.

–delete = This tells rsync to delete any files that are in Directory2 that aren’t in Directory1.

Using the script above, here’s the output generated by using rsync to backup Directory1 to Directory2.

rsync1

Note that without the verbose switch, you wouldn’t receive such detailed information.

That about covers it as far as local backups are concerned.

As it’s possible for you to tell, rsync is very easy to use.

rsync4

Most servers and even many clients already have SSH, and it can be used for your rsync backups.

Notice also that it prompted for a password.

This is to authenticate with SSH.

rsync2

throw in “I” for insert, and then begin editing the cron table file.

It can be a little confusing at first, so let me give you an example.

This will preserve your changes in vi.

rsync3

For more info about Cron, yo see the man pages.

There are a couple of different ways you’ve got the option to encrypt your rsync backups.

We’ll cover these methods in later articles.

rsync5

Linux Commands

Files

tarpvcattacchmodgrepdiffsedarmanpushdpopdfscktestdiskseqfdpandoccd$PATHawkjoinjqfolduniqjournalctltailstatlsfstabecholesschgrpchownrevlookstringstyperenamezipunzipmountumountinstallfdiskmkfsrmrmdirrsyncdfgpgvinanomkdirdulnpatchconvertrcloneshredsrmscpgzipchattrcutfindumaskwctr

Processes

aliasscreentopnicereniceprogressstracesystemdtmuxchshhistoryatbatchfreewhichdmesgchfnusermodpschrootxargsttypinkylsofvmstattimeoutwallyeskillsleepsudosutimegroupaddusermodgroupslshwshutdownreboothaltpoweroffpasswdlscpucrontabdatebgfgpidofnohuppmap

Networking

netstatpingtracerouteipsswhoisfail2banbmondigfingernmapftpcurlwgetwhowhoamiwiptablesssh-keygenufwarpingfirewalld