home blog portfolio Ian Fisher

Shell commands cheatsheet

See also: ref/bash

tar

# create a gzipped archive of a directory with relative paths
# NOTE: '.' at the end
tar -czf OUTFILE --directory=DIR .

# exclude a directory
# NOTE: exclude path is relative to DIR, not the current working directory
tar -czf OUTFILE --exclude=EXCLUDE --directory=DIR .

# extract tarball
tar -xzf TARBALL -C DIR