In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
I. Introduction to packaging tools
Using compressed files saves not only disk space, but also time and network bandwidth
Windows common zip file: rar zip 7z
Linux common compressed files: zip .gz. bz2.xz, .tar,.xz, tar.gz tar.bz2
Second, gzip compression tool
gzip format: gzip(-d -c)# filename , where #is 1-9 numbers, corresponding to 1-9 levels respectively
gzip compression levels 1-9, default 6
-d This parameter is used when decompressing
-c Output compressed files to the specified directory without changing the original files
gzip cannot compress directories
Create a directory named d 6z, use the find command to find files ending in conf: find /etc/ -type f -name "conf" , and then output the file to a file 1.txt
find /etc/ -type f -name "conf" -exec cat {} >>1.txt \;
Repeat appending and checking file size, then compress file
After decompression is completed, if you want to view the contents of the decompressed file, you cannot use cat, you can use zcat, decompress first and then view.
At the same time, when compressing files, you can also specify directories: and the original files will not disappear.
Extract the file and specify the path:
gunzip -c /tmp/1.txt.gz > /tmp/d6z/2.txt
Third, bzip2 compression tool
bzip2 command format is bzip2 (-d) filename -d decompression compression level is also 1-9 levels, default is 9
bzip2 usage is basically the same as gzip, but also can not compress the directory, compression is more severe than gzip, CPU resources are also more expensive
bzip2 command is not installed by default. yum insatll -y bzip2 needs to be installed
View files by bzcat
bzip2 can also specify directories and decompression paths
IV. XZ Compression Tool
xz command format is xz (-d)filename, usage and gzip, bizp2 similar, compression degree is the most severe, also does not support compressed directory
Two decompression methods: xz -d unxz
You can also keep the original file and compress it to a specified directory, or you can specify the path of decompression while saving the original file.
You can use file to view file types
V. Zip compression tool
zip package is commonly used in Windows and Linux, you can compress files and directories, and after compression, the original files will not be deleted
Installation command: yum install -y zip
Usage: zip 1.txt.zip 1.txt zip+ file name of compressed package + source file to be compressed (source file will not be deleted)
-r option can compress multiple files or directories, compressed directory needs to add-r option
To extract files or directories you need to install unzip: yum install -y unzip
When extracting files, since zip compression will not delete the original files, if you do not delete them manually, you will be prompted whether to overwrite or replace them when decompressing. A represents all
Zip to the specified directory:
zip decompression file can not specify the file name, what is the name before decompression or after decompression
VI. tar packing
tar can package directories into one file, consolidate all files or directories into one file, and facilitate copying and moving.
Command format: tar+ options +filename
-c: Create a tar or compressed file package
-v: visualization
-f: Specify the destination file name, use multiple parameters in combination, -f at the end
-t: View the files inside the package
-exclude filename: filter the contents of the file
tar package directory, if the file has been packaged, packaging again will overwrite the file, there will be no prompt
tar supports file directories mixed packaging
tar unpacking
tar View package file list-tf
tar filters specified files
VII. Packaging and compression
You can also use gzip compression at the same time as packaging, plus the-z option; unpacking is to replace the command-c with-x.
Packaging can also use bzip compression, plus-j option; unpacking is to replace the command-c with-x
Packaging can also be used xz compression, plus-J option; unpacking is to replace the command-c with-x
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
Whsle wholesale Cheap discount,Authentic Authentic Jordan 1 Shoes Discount Authentic Air Jordan Shoe
© 2024 shulou.com SLNews company. All rights reserved.