Compression¶
Table of Contents
gzip¶
tar¶
tar¶
Package: tar
Files with the “.tar” extension are archived (not compressed).
Usage |
Explanation |
---|---|
-x |
extracts a tar file |
-k |
do not delete existing files |
-c |
create a tar file |
-f |
use archive file |
-t |
lists files inside a tar file |
-T |
specify a file of directory/file names to tar |
-v |
verbosely display output |
-z |
compresses the archive using gzip to make a .tar.gz file |
-J |
uses xz compression |
-C |
specify the directory to extract to |
–selinux |
keep SELinux permissions |
–acls |
keep ACLs |
–xattrs |
keep extended attributes |
Example |
Explanation |
---|---|
-zcvf /home /root/home_backup.tar.gz |
create a backup of the home directory |
xz¶
xz¶
Package: xz
Best for compressing text files (saves the most space).
Usage |
Explanation |
---|---|
-z, –compress |
compress files |
-d, –decompress |
decompress files |
–threads 0 |
use the number of hyperthreads available from the CPU for faster processing |
-0 |
fast compression, takes less time |
-9 |
high compression, takes longer |
zip¶
unzip¶
Usage |
Explanation |
---|---|
-d <DEST_DIR> |
specify a destination directory to extract to |
-j |
decompress files to the current working directory |
-l |
list contents of the archive |
Example |
Explanation |
---|---|
-j <ZIP_FILE> <PATH_TO_COMPRESSED_FILE> |
decompress a specific file and save it to the current working directory |