Skip to content

Instantly share code, notes, and snippets.

@ppoffice
Last active September 2, 2022 19:20
Show Gist options
  • Save ppoffice/6f9b02404516c894f82cc33c072c3130 to your computer and use it in GitHub Desktop.
Save ppoffice/6f9b02404516c894f82cc33c072c3130 to your computer and use it in GitHub Desktop.
Backup Linux using tar
#!/bin/bash
cd /
tar -cvpzf backup.tar.gz \
--exclude=/backup.tar.gz \
--exclude=/proc \
--exclude=/tmp \
--exclude=/mnt \
--exclude=/dev \
--exclude=/sys \
--exclude=/run \
--exclude=/media \
--exclude=/lost+found \
--exclude=/var/log \
--exclude=/var/cache/apt/archives \
--exclude=/usr/src/linux-headers* \
--exclude=/home/*/.gvfs \
--exclude=/home/*/.cache \
--exclude=/home/*/.local/share/Trash \
/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment