0 can also be specified with the flag -fast, while option -9 can also be specified with the flag -best, these are provided for backwards compatibility with older tools and should be avoided. The below example compares the differences between -0 and -9, as shown while -0 finishes much faster it compresses around 6% less (approximately 37mb more space ~]# time xz -0v linux-3.18.19.tarġ00 % 112.1 MiB / 553.9 MiB = 0.202 12 MiB/s 0:44ġ00 % 77.0 MiB / 553.9 MiB = 0.139 1.1 MiB/s 8:20 Using option 9 will take longer to complete, however you will have the largest amount of space saved. Using option 0 will complete faster, but space saved from the compression will not be optimal. The level of compression applied to a file using xz can be specified as a value between 0 (less compression) and 9 (best compression). This only works for files that have a known size, it will not work if you are piping content into xz. In the below example we are compressing the Linux kernel with xz with -v which is showing us the current percentage, compression ratio, MB/s, elapsed time and estimated amount of time until completion which is very useful information especially when compressing a large test]# time xz -v linux-3.18.19.tarĢ1.4 % 18.6 MiB / 118.6 MiB = 0.157 1.3 MiB/s 1:28 5 min 30 s The -v or -verbose flag can be specified to provide up to date information on a running operation. In this example, an xz copy of the Linux kernel has compressed to 14.4% of its original size, taking up 79.7MB of space rather than 553.9MB. Strms Blocks Compressed Uncompressed Ratio Check Filenameġ 1 79.7 MiB 553.9 MiB 0.144 CRC64 linux-3.18.19.tar.xz xz file such as the compressed and uncompressed size of the file as well as the compression ratio, which shows us how much space our compression is ~]# xz -l linux-3.18.19.tar.xz With the -l or -list flag we can see useful information regarding a compressed. Similar to example 3, it is possible to decompress a file and keep the original. To reverse the compression process and get the original file back that you have compressed, you can use the xz command itself or unxz which is also part of the xz package.īoth of these commands will produce the same result, decompressing to file.txt, removing the compressed file. The -c flag outputs the compressed copy of file.txt to stdout, this is then sent to, keeping the original file.txt file in place. This can also be done with the -c flag as below. You can instead keep the original file and create a compressed copy with the -k or -keep flag. Compress a single file and keep the original To instead compress all files within a directory, see example 10 below. This will compress all files specified in the command, note again that this will remove the original files specified by turning file1.txt, file2.txt and file3.txt into, and This will compress file.txt and create, note that this will remove the original file.txt file. We are going to cover 13 examples of xz here, showing you common tasks that can be completed and just how easy it is to use.Ĭheck out some of our other compression tool examples:īefore starting you will need to have the xz package installed, this is usually already installed by default, however you can install it now if required.ĭebian: apt-get install xz-utils Example XZ Commands With xz we will typically get a better compression ratio. Xz is another general purpose data compression tool with syntax similar to the older and more popular gzip and bzip2 options.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |