Skip to content

Instantly share code, notes, and snippets.

@peterdemartini
Created December 4, 2013 17:55
Show Gist options
  • Save peterdemartini/7792276 to your computer and use it in GitHub Desktop.
Save peterdemartini/7792276 to your computer and use it in GitHub Desktop.
Collection of tar commands. Great for backing up and restoring directories.
#Tar and gzip with excludes
tar -zcvf backup.tar.gz --exclude="*.zip" --exclude="*.sql" *
#Tar and gzip while putting file in foriegn location
tar -zcvf /usr/local/backups/backup.tar.gz *
#Just tar
tar -cvf /usr/local/backups/backup.tar *
#Restore from tar.gz
cd /location/to/untar/to
tar -zxvf /path/to/backup.tar.gz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment