Compression and decompression command
Article Directory
learning target
- Able to use the tar command to complete file compression and decompression
1. Introduction compression format
Linux compression format supported by default:
- .gz
- .bz2
- .zip
Description:
- .gz and .bz2 compression needs to use the tar command to compress and decompress
- .zip compression needs to use the zip command to compression, unzip command to decompress
Compression Purpose:
- Save disk space
Use 2. tar command and options
command | Explanation |
---|---|
takes | Compression and decompression command |
tar command options:
Options | Explanation |
---|---|
-c | Create a package file |
-v | Details display packing or unpacking |
-f | Specify the file name, you must put all options back |
-from | Compressing or decompressing (.gz) |
-j | Compressing or decompressing (the .bz2) |
-x | Unpack |
-C | Unzip to a specified directory |
FIG .gz is compressed into effect:
FIG .bz2 compressed into effect of:
FIG .gz decompression effect of:
Decompression to the specified directory .gz renderings:
FIG .bz2 decompression effect of:
Decompressing .bz2 to the specified directory renderings:
Use 3. zip and unzip commands and options
command | Explanation |
---|---|
zip | Into a .zip file format |
unzip | Unzip the .zip file format |
unzip command options:
Options | Explanation |
---|---|
-d | Unzip to a specified directory |
FIG .zip is compressed into effect:
FIG .gz decompression effect of:
Decompress .zip to the specified directory renderings:
Description:
- .Gz compressed file format as much as possible to use, as there is less space
- Use the zip command more compressed files take up space, then more generic, more simple operation.
4. Summary
- .gz and .bz2 compressed files using the tar command to complete the compression and decompression
- .zip compressed files using zip and unzip command to complete compression and decompression