tar options to make a complete backup


tar -pczvf backup.tgz dir
  • p = preserve permissions (so executables stay executable)
  • c = create
  • z = compress
  • v = verify
  • f = to a named file

It is important to use a directory name, not a file name. Otherwise, it will not include dot files.

To backup only specific files, create a files.txt with find and then pass --from-file files.txt instead of dir

source

Date: 2019-08-10

Tags:  bash

Share: