In general, the common types of compressed files in Linux are zip, gz, and tar. let's first introduce the most common zip file compression and decompression commands in Linux.
Generally, in Linux, the common types of compressed files are .zip,.gzand .tar. we will first introduce the compression and decompression commands for the latest. zip files.
The commands for processing. zip files in Linux are zip and unzip. Zip and unzip programs are located in the/usr/bin directory, which are the same as pkzip, pkunzip, and MS-windows Winzip software in MS-DOS, and can be compressed into files. zip File to save hard disk space, and unbind the compressed file when necessary.
Zip command for compressing files
Zip can be used to compress files. if we need to compress many files, we can even compress them into one file. The following describes the zip syntax and available parameters:
In fact, the most common method for zip is to add the compressed file name and the file to be compressed, because the zip command is available on many OS platforms and has many parameters, here I will only introduce some Linux parameters:
-1: The fastest compression, the worst compression ratio.
-9: The maximum compression ratio is the best.
-B: Path of the temporary file. This parameter usually exists in the zip file to be generated, but the existing space on the hard disk is insufficient.
-C: add a line of annotation for the newly added or updated file.
-D: remove a file from the zip file.
-D: Do not store the directory information of a file in a zip file.
-F: replace existing files with new files.
-F: fix damaged compressed files.
-G: compress the file and append it to the zip file.
-H: displays auxiliary instructions.
-I: specify certain files to be included.
-J: only stores the file name, excluding the directory.
-K: force the MSDOS format file name.
-L: converts CR (Carriage Return) LF (Line Feed) to LF. this parameter is generally used only when the text file on the MS-DOS is compressed to UNIX. This is only applicable to text files (. txt). if it is used for binary files, it will damage the binary files.
-L: copyright of the zip command.
-M: move a specific file into a zip file and delete it.
-N: do not compress files with a specific extension.
-O: Set the time of the zip file to the time when the zip file is last modified.
-Q: In quiet mode, no messages or prompts are displayed.
-R: including subdirectories.
-T: only files after mmddyy date are processed.
-T: test whether the zip file is normal.
-U: update only the changed files and new files.
-V: displays version information or details.
-X: files that do not need to be compressed.
-Y: compress the symbolic link, instead of compressing the linked file.
-Z: add annotation to the zip file.
-#: Sets the compression speed.-0 indicates no compression, and-1 indicates the fastest compression speed,
-9 indicates the slowest compression speed (optimized compression). The default value is-6.
-@: Read the file name from the standard input.
Unzip command for uncompressing files
The unzip command is used to unzip the. zip file. the unzip command syntax is similar to that of zip. the parameters are not described here.
Tar of the packaged file
The tar program is located in the/usr/bin directory. The Common compression method on UNIX is to first use tar to compress many files (which may contain subdirectories) package it into one file (gzip and compess can only compress one file), and compress it into xxx.tar.gz (or xxx. tgz) file.
Due to the wide variety of tar parameters, I will first introduce the common tar methods:
Paul :~ /Tar cvf filesname.tar <-pack all files into filesname.tar. add the extension. tar on your own.
Paul :~ /Tar cvzf filesname.tar.gz <-pack all files into filesname.tar and compress them with gzip.
Paul :~ /Tar tvf filesname.tar <-check which files are included in the filesname.tar file.
Paul :~ /Tar xvf filesname.tar <-unbind filesname.tar.
KDE archiver
KDE archiver is like the winzip of MS-wondows. It can also uncompress zipw.gzipw.tarw.tar.gz and other compressed files.