Create a backup on linux using tar.gz

Backup using tar with compression

sudo tar czvf backup.$(date +%Y-%m-%d_%H%M).tgz /source/folder/to/backup/

sudo tar czvf backup.tar.gz foldername/
sudo tar czvf everything.tar.gz *

To check for error while making your tar ballĀ 

sudo tar czvf backup.$(date +%Y-%m-%d_%H%M).tgz /source/folder/to/backup/ 2> error.txt

Extract from backup

sudo tar -zxvf backup.tar.gz

Leave a Comment

Your email address will not be published. Required fields are marked *