Thoughts on how to improve my rsync command?

Hey guys, didn't think this was worth putting as an issue as it isn't related to Garuda, but as there are many smart people here, I was wondering if someone could give a few pointers on how to fix my script if anyone is that familiar with rsync? I've been googling around and have become more confused haha. Currently, excluding doesn't seem to work in the case of baloo index file and other files that should be excluded. Would appreciate any pointers on how to fix up my command so I can cut down unnecessary time backing up. Thanks!

sudo rsync -aAXHv / --delete --exclude={"/swapfile","/.snapshots","/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/cdrom/*","/lost+found","/backup","/home/*/.thumbnails/*"," /home/*/.cache/*"," /home/*/.local/share/Trash/*"," /home/*/.local/share/baloo/*"," /var/lib/dhcpcd/*"} / /mnt/sdc1/rsyncbackup

It looks like you have extra whitespace in front of the baloo path and a couple of others.

These all have extra whitespace:

" /home/*/.cache/*"," /home/*/.local/share/Trash/*"," /home/*/.local/share/baloo/*"," /var/lib/dhcpcd/*"

Oh I see haha, yeah that was a dumb mistake on my part so thanks for spotting that. Just to be clear though, you do mean the white space after the " and before the next / correct? So for example:

" /home/*/.cache/*"," /home/*/.local/share/Trash/*"," /home/*/.local/share/baloo/*"," /var/lib/dhcpcd/*"

Should be:


Yes, exactly.

1 Like

--exclude-from=FILE read exclude patterns from FILE


-> * work for all user(s)?


That's a good way to make the command shorter so thanks. Didn't know you could have the exclude list as a file. However for me I don't need this as I created an alias called rsyncbackup so I don't have to worry about the length of the command as it always stays the same. And yes AFAIK, * is a wildcard that does mean all users as when checking my backup directory, there is the guest user as well as my adamj user.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.