Compression
bzip
bzip2
Package: bzip2
Files with the “.bz2” extension are compressed.
Usage |
Explanation |
---|---|
-v |
verbosely display output |
cpio
cpio
Package: cpio
cpio
means copy input/output. This format is used for RPMs.
Usage |
Explanation |
---|---|
-id |
extract files AND directories |
Example |
Explanation |
---|---|
rpm2cpio httpd.rpm | cpio -id |
extract files and directories from the Apache RPM |
dtrx
dtrx
Do the right extract (dtrx) is a universal compression utility for all formats. By default it runs in an interactive mode.
Usage |
Explanation |
---|---|
-m |
extract metadata from ‘.rpms’, ‘.deb’, or ‘.gem’ packages |
gzip
gzip
Package: gzip
Files with the “.gz” extension use gzip compression
Usage |
Explanation |
---|---|
-d |
decompress a file |
-r |
recursively compress files |
-v |
verbosely display output |
pigz
pigz
provides automatic multi-threaded compression and decompression for gzip
. See gzip
for possible arguments.
rar
rar
Usage |
Explanation |
---|---|
-v |
verbosely display output |
unrar
star
This archive tool provides the ability to retain special ACL permissions.
star
Package: star
star
provides extra capabilities to tar
that allow for properly storing various types of attributes.
Usage |
Explanation |
---|---|
-x |
extract |
-v |
verbosely |
-f= |
provide the full file path to the ‘.star’ archive |
-xattr |
preserve extended attributes such as SELinux permissions |
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 |
jar
Package: java-openjdk
Jar files are Java applications that are compressed using zip
.
Usage |
Explanation |
---|---|
cf |
create a Jar archive |
xf |
extract a Jar archive |
zip
Package: zip
Usage |
Explanation |
---|---|
-v |
verbosely display output |
-r |
recursively; for directories |
Example |
Explanation |
---|---|
-r root_archive.zip /root/ |
create a zip archive of the root user home directory |