Tar usage
From raju
Contents
count number of lines in a txz file
xz -cd foo.txz | wc -l
for i in *.txz; do echo $i; xz -cd $i | wc; done
file extensions
- tar gzip compressed - .tgz
- tar bzip2 compressed - .tar.bz2, .tar.bz, .tbz
- tar xz compressed - .txz
sample commands
tar cJvf foo.txz foo
compression algos
- compression ratio
Defined as Uncompressed size / compressed size.
xz > bzip2 > gzip
xz gives the smallest files.
Rule of thumb: files compressed with xz are 20% smaller compared to files compressed with gzip.
- time to compress
xz > bzip2 > gzip
xz is slowest, gzip is fastest.
Ref:-
- https://www.rootusers.com/gzip-vs-bzip2-vs-xz-performance-comparison/
- https://en.wikipedia.org/wiki/Data_compression_ratio
Remove all files previously extracted from a tar(.gz) file
tar -tf <file.tar.gz> | xargs rm -r
tags| uninstall files untarred from a tar file
convert tgz to txz
cat foo.tgz | gzip -cd | xz > foo.txz
To do the other way around
cat foo.txz | xz -cd | gzip > foo.tgz
Ref:- http://lowfatdaemon.blogspot.com/2012/01/how-to-repackage-txz-to-tgz-slackware.html
tags | change compression algorithm of a tar archive