I wanted to make a backup of my home folder before reinstalling my OS to make setup easier. I wanted to exclude my steam folder as it is really big and can be reinstalled easily. I also keep a separate backup of my Documents folder and it too is big
I am backing up to a network drive mounted as /mnt/dsik2
Here is the tar command I used to backup everything excluding those two folders
`tar –exclude=‘./Documents’ –exclude=‘./.local/share/Steam’ -zcvf /mnt/disk2/hometar.tgz .
some notes on the syntax
This command needs to be run from within the home folder as the ./ in the excludes designates the folder is a subfolder of the current directory
One could also use ~/ to designate the users home folder but that could get you in trouble if you tried to use this on a folder not in your home.
the . at the end also denotes the current directory. .. would designate one level up from current directory