Skip to content

Instantly share code, notes, and snippets.

@armancohan
Last active April 10, 2024 12:09
Show Gist options
  • Save armancohan/574d0a2b55090bfa917c7fec76150f0a to your computer and use it in GitHub Desktop.
Save armancohan/574d0a2b55090bfa917c7fec76150f0a to your computer and use it in GitHub Desktop.
compress large directory with tar, show progress

You need to have pv installed.

Command:

tar -cf - [Source directory] -P | pv -s $(du -sb [Source dir] | awk '{print $1}') | gzip > [Dest tar.gz file]

Example:

tar -cf - dir/ -P | pv -s $(du -sb dir/ | awk '{print $1}') | gzip > file.tar.gz
@samuelmf
Copy link

Great command, i loved it!
Can it be used with single files like a video mp4?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment