Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Tar can be used to backup an entire directory keeping all permissions and users accounts intact. The trick is to use sudo to keep the permissions intact.

Note

In this case, order of the switches (zcvpf) does matter. Otherwise, you will get an error (record the error here) once the tar command finishes.

Code Block
languagebash
# To tar the directory
sudo tar -zcvpf tarfile.tar.gz ./folder
 
# To untar and gunzip the file in one command
sudo tar -zxvpf tarfile.tar.gz
 
# Encrypting a tar
...