Last active
October 14, 2023 15:02
-
-
Save hitorilabs/82f5f09fe03258b5edd6fd38122b5cae to your computer and use it in GitHub Desktop.
script for backing up a system, I personally ignore home because I don't keep anything important in there - I just clean install when needed. To extract the file, replace `-c` with `-x` and specify the destination (note: this will overwrite existing files)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
: ${DESTINATION_DIRECTORY:=} [0/0] | |
: ${BACKUP_FILENAME:=$(date +%Y%m%d%H%M%S)-backup.tar.gz} | |
tar -czpvf $DESTINATION_DIRECTORY/$BACKUP_FILENAME \ | |
--exclude=/proc \ | |
--exclude=/tmp \ | |
--exclude=/mnt \ | |
--exclude=/dev \ | |
--exclude=/sys \ | |
--exclude=/run \ | |
--exclude=/var \ | |
--exclude=/usr \ | |
--exclude=/home / |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://help.ubuntu.com/community/BackupYourSystem/TAR
tar
- is the command that creates the archive. It is modified by each letter immediately following, each is explained below.c - create a new backup archive.
v - verbose mode, tar will print what it's doing to the screen.
p - preserves the permissions of the files put in the archive for restoration later.
z - compress the backup file with 'gzip' to make it smaller.
f - specifies where to store the backup, backup.tar.gz is the filename used in this example. It will be stored in the current working directory, the one you set when you used the cd command.