In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you how to use the tar command of the Linux system, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
Tar command is used to synthesize multiple files into one file. In wiki, this command and cpio, shar, etc., are called archive files. Personal understanding is to archive and synthesize a file, and then you can use gzip, bz2, xz and other tools to compress.
1. Command format tar required parameters [file]
2. The command function is used to compress and extract files. Tar itself does not have compression capabilities. It is implemented by calling the compression function.
3. The necessary parameters of the command parameters are as follows:
-An add compressed files to existing compressed files
-B sets the block size
-c create a new compressed file
-d differences in recording files
-r add a file to a compressed file
-u add changed and existing files to existing compressed files
-x extract files from compressed files
-t displays the contents of the compressed file
-z supports gzip decompression of files
-j supports bzip2 decompression of files
-Z supports compress decompression of files
-v displays the operation process
-l file system boundary settin
-k keep the original file without overwriting
-m keep the file from being overwritten
-W confirm the correctness of the compressed file
The optional parameters are as follows:
-b set the number of blocks
-C switch to the specified directory
-f specifies the compressed file
-help displays help information
-version displays version information
4. Common decompression / compression commands tar unpack: tar xvf FileName.tar package: tar cvf FileName.tar DirName (Note: tar is packaging, not compression! )
.gz decompress 1:gunzip FileName.gz decompress 2:gzip-d FileName.gz Compression: gzip FileName
.tar.gz and .tgz decompression: tar zxvf FileName.tar.gz compression: tar zcvf FileName.tar.gz DirName
.bz2 decompress 1:bzip2-d FileName.bz2 decompress 2:bunzip2 FileName.bz2 Compression: bzip2-z FileName
.tar.bz2 decompression: tar jxvf FileName.tar.bz2 compression: tar jcvf FileName.tar.bz2 DirName
.bz decompression 1:bzip2-d FileName.bz decompression 2:bunzip2 FileName.bz compression: unknown
.tar.bz decompression: tar jxvf FileName.tar.bz compression: unknown
Z decompression: uncompress FileName.Z compression: compress FileName
.tar.Z decompression: tar Zxvf FileName.tar.Z compression: tar Zcvf FileName.tar.Z DirName
.zip decompression: unzip FileName.zip compression: zip FileName.zip DirName
.rar decompression: rar x FileName.rar compression: rar a FileName.rar DirName
5. Use example 1: package all files into tar packages
Command:
Tar-cvf log.tar log2012.log
Tar-zcvf log.tar.gz log2012.log
Tar-jcvf log.tar.bz2 log2012.log
The above is all the contents of this article entitled "how to use tar commands in Linux system". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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
© 2024 shulou.com SLNews company. All rights reserved.