Translations:Tar/5/en
Jump to navigation
Jump to search
How to compress and uncompress tar files
tar
can compress an archive file at the same time it creates it. There are a number of compression methods to choose from. We recommend either xz
or gzip
, which can be used like so:
[name@server ~]$ tar --create --xz --file project1.tar.xz project1
[name@server ~]$ tar --extract --xz --file project1.tar.xz
[name@server ~]$ tar --create --gzip --file project1.tar.gz project1
[name@server ~]$ tar --extract --gzip --file project1.tar.gz
Typically, --xz
will produce a smaller compressed file (a "better compression ratio") but takes longer and uses more RAM while working [1]. --gzip
does not typically compress as small, but may be used if you encounter difficulties due to insufficient memory or excessive run time during tar --create
.