docs.daveops.net

Snippets for yer computer needs

File Archiving

Tar

# Clean a tar-bombed directory
tar -tf <file.tar.gz> | xargs rm -r

# Remove VCS junk
tar --exclude-vcs -cf src.tar src/

# Creating a gzipped tarball
tar czfv tobemade.tar.gz tobezipped/

# Extract tar.gz
tar zxvf [file]

# Extract tar.bz2
tar jxvf [file]

# Extract to a directory
tar ... -C /send/to/

cpio

flag description
-i input
-o output
-p pass-through

Diffoscope home page

Restic docs

# Initialize the repo
restic init -r $REPO_PATH

# Run a backup
restic backup -r $REPO_PATH $PATH_TO_BACKUP

# List snapshots
restic snapshots -r $REPO_PATH