Tar Option to Use External Compression Program on Ubuntu
This article explains how to configure the tar utility in Ubuntu to utilize external compression tools. It identifies the specific command-line flag required to integrate third-party compressors instead of built-in methods. Readers will learn the syntax and see practical examples of implementing this feature.
The specific option that allows tar to use an external compression
program is --use-compress-program. You can also use the
shorthand -I to achieve the same result. This flag
instructs tar to pipe data through a specified external command for
compression or decompression rather than using internal flags like
-z or -j.
To implement this, append the option followed by the program name to
your tar command. For example, if you want to use pigz for
parallel gzip compression, you would run:
tar --use-compress-program=pigz -cf archive.tar.gz /path/to/folder
Using the short form simplifies the command structure:
tar -I pigz -cf archive.tar.gz /path/to/folder
This method works with any compression utility that reads from standard input and writes to standard output. It provides flexibility when native tar flags do not support your preferred algorithm on your Ubuntu system.