Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

Tar unlike zip allow you to keep permissions. As such it is the defacto utility for making backups. Also if you can keep your user UIDs consistent across environments, tar allows for quick disaster recovery.

Must Read

Before using tar there are one critical behaviour to understand, always tar using relative paths. Otherwise you risk overwriting your data when untaring.

TBC Roderick, put an example of that here with more details.

Backing Data

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.

Also, using this method, tar up a real directory, not a symbolic link to one.

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.

# 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
...
  • No labels