There are many file formats and extensions on Linux, and the commands and parameters used by each format are also different. Aiming at this problem, a summary is made.
Unzip a file called 'file1.bz2'
bunzip2 file1.bz2
Compress a file called 'file1'
bzip2 file1
Unzip a file called 'file1.gz'
gunzip file1.gz
Compress a file called 'file1'
gzip file1
maximum compression
gzip -9 file1
Create a package called 'file1.rar'
rar a file1.rar test_file
Simultaneously compress 'file1', 'file2' and directory 'dir1'
rar a file1.rar file1 file2 dir1
Unzip the rar package
rar x file1.rar
Unzip the rar package
unrar x file1.rar
Create an uncompressed tarball
tar -cvf archive.tar file1
Create an archive containing 'file1', 'file2' and 'dir1'
tar -cvf archive.tar file1 file2 dir1
show the contents of a package
tar -tf archive.tar
release a package
tar -xvf archive.tar
Release the compressed package to the /tmp directory
tar -xvf archive.tar -C /tmp
Create a compressed package in bzip2 format
tar -cvfj archive.tar.bz2 dir1
Decompress a compressed package in bzip2 format
tar -xvfj archive.tar.bz2
Create a compressed package in gzip format
tar -cvfz archive.tar.gz dir1
Decompress a compressed package in gzip format
tar -xvfz archive.tar.gz
Create a compressed package in zip format
zip file1.zip file1
Simultaneously compress several files and directories into a compressed package in zip format
zip -r file1.zip file1 file2 dir1
Unzip a zip format archive
unzip file1.zip