Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the xz command in Linux

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to use the xz command in Linux". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn how to use the xz command in Linux.

Linux common command XZ Utils is a free general data compression software with high compression rate. XZ Utils is written for systems like POSIX, but can also work on systems that are not POSIX. XZ Utils is the successor to LZMA Utils.

The core of the XZ Utils compression code is based on LZMA SDK, but it has been heavily modified to fit XZ Utils. Currently, the main compression algorithm is LZMA2, which is used within the .xz container format. For typical files, the output of XZ Utils is 30% smaller than gzip and 15% smaller than bzip2.

XZ Utils consists of several components:

Liblzma is a compression library whose API is similar to zlib. Xz is a command-line tool with a syntax similar to gzip. Xzdec is a tool for decompression only, which is smaller than the full-featured xz tool. Adapted a set of Shell scripts (xzgrep,xzdiff, etc.) from gzip to simplify the process of viewing, grepping, and comparing compressed files. The emulation of the LZMA Utils command line tool simplifies the transition from LZMA Utils to XZ Utils.

Although liblzma has an API similar to zlib, liblzma does not contain any file I / O functions. It is planned to use a separate I / O library that will handle .gz, .bz2, and .xz files using the easy-to-use API abstraction.

The format of the command is as follows:

Xz [OPTION]... [FILE]... # compress or extract files in .xz format. The mandatory parameter of the long option is also mandatory for the short option. -z,-- compress forced compression-d,-- decompress forced decompression-t,-- test test compressed file integrity-l,-- list lists information about files-- k,-- keep retains (does not delete) input files-f,-- force forcefully overwrites output files and (cancels) compressed links-c -- stdout writes to standard output Do not delete the input file-0.. -9 compression preset; 0-2 fast compression, 3-5 good compression, 6-9 excellent compression; default is 6-e,-- extreme encoding uses more CPU time to increase compression without increasing decoder memory usage-Q,-- quiet cancels the warning Specifying twice can also cancel the error-v,-- verbose detail; specify-h for more details twice,-- help displays this short help-H,-- long-help displays long help (also lists advanced options)-V,-- version shows the version number # if there is no file, or when the file is -, read standard input. # report errors to (English or Finnish). # xz-utils home page: eg:xz 1.txt compressed file, the source file disappears after compression, xz- z test.txt compressed file du-sh 1.txt.xz view the compressed file, the size xz- d 1.txt.xz is decompressed, and the decompressed package disappears after decompression. Unxz 1.txt.xz unzipped the file with xz- d xz- c 1.txt >. / 2.txt.xz compressed file to the specified directory | supports renaming the compressed file name, and the source file does not disappear after compression | more views the contents of the file in the package xz-c-d 2.txt.xz >. / 2.txt decompresses the file to the specified directory and supports renaming | The compressed package does not disappear unxz-c 2.txt.xz >. / 3.txt ditto xz- d linux-3.12.tar.xz # decompress the xz format file tar-xf linux-3.12.tar # first use the xz command of xz-utils to extract linux-3.12.tar.xz to linux-3.12.tar, and then use the tar command to decompress linux-3.12.tar completely. The effect of tar-Jxf linux-3.12.tar.xz # is the same as the above two steps. It is recommended to use tar-cf linux-3.12.tar linux-3.12/ # to create a xz format file xz- z linux-3.12.tar # first, use the tar command to package the linux-3.12 folder into linux-3.12.tar, and then use the xz-utils xz command to compress linux-3.12.tar into linux-3.12.tar.xz. Tar-Jcf linux-3.12.tar.xz linux-3.12/ # is equivalent to the above two steps, it is recommended to use thank you for reading, the above is the content of "how to use the xz command in Linux". After the study of this article, I believe you have a deeper understanding of how to use the xz command in Linux, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report