tar Command Examples

Archiving utility. Often combined with a compression method, such as gzip or bzip2. More information: https://www.gnu.org/software/tar.

tar cf {{path/to/target.tar}} {{path/to/file1 path/to/file2 ...}}

tar czf {{path/to/target.tar.gz}} {{path/to/file1 path/to/file2 ...}}

tar czf {{path/to/target.tar.gz}} --directory={{path/to/directory}} .

tar xvf {{path/to/source.tar[.gz|.bz2|.xz]}}

tar xf {{path/to/source.tar[.gz|.bz2|.xz]}} --directory={{path/to/directory}}

tar caf {{path/to/target.tar.xz}} {{path/to/file1 path/to/file2 ...}}

tar tvf {{path/to/source.tar}}

tar xf {{path/to/source.tar}} --wildcards "{{*.html}}"