-
Use the gzip and gunzip commands
- The gzip command is used to compress commands. The generated compressed files end in. Gz, while the gunzip command is used to decompress files end in.
- Grammar:
- Gzip -v Specifies the name of the file
- Gunzip -v Specifies the name of the file
- The -v option displays the compression ratio of the compressed file or information when the file is decompressed
-
Using the tar command tar is a command line tool for file packaging. The tar command can archive a series of files into a large file or unpack the file to recover data. In general, tar is mainly used for packaging and unpacking. The common parameters of the tar command are as follows:
- -c: Generates an archive file
- -v: Indicates the detailed process of exhausting archive files
- -f: Specifies the file name
- -r: appends the file to the end of the file
- -z: compresses or decompresses files in gzip format
- -j: compresses or decompresses files in bzip2 format
- -d: compares files with files in the current directory
- -x: Unlocks the file
Such as:
#tar -cvf yy.tar aa tt // Archive the aa and TT files in the current directory as yy.tar
#tar -xvf yy.tar // Retrieve data from yy.tar file
#tar -czvf yy.tar.gz aa tt // Archive the AA and TT files in the current directory and compress them into Yy.tar.gz
#tar -xzvf yy.tar.gz // Decompress the yy.tar.gz file and restore data
Copy the code