The article directories
-
- Packing compression
-
- Pack/unpack
-
- Packing and unpacking drill
- Compress/uncompress
-
- 1) `gzip`
- 2) `bzip2(two)`
Packing compression
-
Packaging compression is a way to back up files in your daily work
-
In different operating systems, the commonly used packaging and compression methods are different
Windows
The commonly usedrar
Mac
The commonly usedzip
Linux
The commonly usedtar.gz
Pack/unpack
tar
Is the most commonly used in LinuxThe backupTool, this command canA series of documentsPackaged inIn a big file, you can also put aThe packaged large file is restored as a series of filestar
The command format is as follows:
# package fileTar -cvf Package file tar Package file/path...Unpack the fileTar -xvf Package file. TarCopy the code
tar
Option to show
options | meaning |
---|---|
c | Generate archive files and create package files |
x | Unpack the files |
v | Lists the details of the archiving process, showing progress |
f | Specify the name of the file, f must be followed by.tar, so the option must end |
Note: the f option must be placed last. The other options can be placed in any order
Packing and unpacking drill
- Delete everything under the desktop
- Create three blank files
01.txt
,02.txt
,03.txt
- Type these three documents into one
123.tar
The package - new
tar
Directory, and will123.tar
Move to thetar
directory - Unpack the
123.tar
Compress/uncompress
1) gzip
-
Tar can be used with the gzip command to package and compress implementation files
tar
Only packages files, but does not compress them- with
gzip
The compressiontar
The extension of the packaged file is generally usedxxx.tar.gz
In Linux, the most common compressed file format is XXX.tar. gz
- in
tar
There is an option in the command-zYou can callgzip
, so that you can easily realize the function of compression and decompression - The command format is as follows:
Zip fileTar -zcvf Package file.tar. gz Compressed file/path...Unzip the fileTar -zxvf Package file.tarUnzip to the specified pathTar -zxvf Package file.tar. Gz -c Target pathCopy the code
options | meaning |
---|---|
-C | Extract to the specified directory. Note: The directory to extract must exist |
2) bzip2(two)
-
Tar in combination with the bzip2 command can be packaged and compressed using implementation files (same as gzip)
tar
You pack files, but you don’t compress them,- with
bzip2
The compressiontar
The extension of the packaged file is generally usedxxx.tar.bz2
-
The tar command has an option -j to call bzip2, which makes it easy to compress and decompress
-
The command format is as follows:
Zip fileTar -jcvf Package file.tar. Bz2 Compressed file/path...Unzip the fileTar -jxvf Package file.tar.bz2Copy the code