Skip to content

Instantly share code, notes, and snippets.

@Kautenja
Last active November 12, 2024 22:00
Show Gist options
  • Save Kautenja/af670104f13c94f92b69ce054ee96b42 to your computer and use it in GitHub Desktop.
Save Kautenja/af670104f13c94f92b69ce054ee96b42 to your computer and use it in GitHub Desktop.
one-liners for using tar with gzip and pv for a progress bar

Compress

tar cf - <files> -P | pv -s $(du -sb <files> | awk '{print $1}') | gzip > <some .tar.gz file>

where:

  • <files> is the root-mounted (i.e. starts with /) path to the files
  • <some .tar.gz file> is the output tarball to create

Decompress

pv <some .tar.gz file> | tar -xvzf - -C <some directory>

where:

  • <some .tar.gz file> is the path to the tarball to extract
  • <some directory> is the directory to extract the tarball to
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment