1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | $ xz --help Usage: xz [OPTION]... [FILE]... Compress or decompress FILEs in the .xz format. -z, --compress force compression -d, --decompress force decompression -t, --test test compressed file integrity -l, --list list information about .xz files -k, --keep keep (don't delete) input files -f, --force force overwrite of output file and (de)compress links -c, --stdout write to standard output and don't delete input files -0 ... -9 compression preset; default is 6; take compressor *and* decompressor memory usage into account before using 7-9! -e, --extreme try to improve compression ratio by using more CPU time; does not affect decompressor memory requirements ... |
1 2 3 | $ xz test.txt $ ls test.txt* test.txt.xz |
1 2 3 | $ xz -d -k test.txt.xz $ ls test.txt* test.txt.xz test.txt |
1 2 3 | $ xz -l index.txt.xz Strms Blocks Compressed Uncompressed Ratio Check Filename 1 1 768 B 1,240 B 0.619 CRC64 index.txt.xz |
1 2 | $ xz -k7 xz_pipe_decomp_mini.c $ xz -k --fast xz_pipe_decomp_mini.c |
1 2 | $ tar cf - *.c | xz --best > src.tar.xz # compress $ xz -d src.tar.xz --stdout | tar -x # decompress |
1 2 | $ tar cJf src.txz *.c # compress $ tar xJf src.txz # decompress |
1 | $ xz -H | more |
1 | # find /var/log -type f -iname "*.log" -print0 | xargs -P4 -n16 xz -T1 |
1 2 3 4 5 6 7 8 9 | $ xzcat concat_1.txt.xz .xz file concatenation test: ~ file1 ~ $ xzcat concat_2.txt.xz .xz file concatenation test: ~ file2 ~ $ cat concat_1.txt.xz concat_2.txt.xz > concat.txt.xz #concatenation $ xz -d concat.txt.xz #decompress $ cat concat.txt #print file concat.txt .xz file concatenation test: ~ file1 ~ .xz file concatenation test: ~ file2 ~ |
1 2 3 4 5 6 7 | $ xz --list xz_pipe_mini.exe.xz ## normal output Strms Blocks Compressed Uncompressed Ratio Check Filename 2 2 12.8 KiB 42.7 KiB 0.300 CRC64 xz_pipe_mini.exe.xz $ xz --list --robot xz_pipe_mini.exe.xz ## robot model name xz_pipe_mini.exe.xz file 2 2 13112 43695 0.300 CRC64 0 totals 2 2 13112 43695 0.300 CRC64 0 1 |
1 2 3 4 | $ xz -l --robot xz_pipe_mini.exe.xz | gawk \ '/^name/ {printf "%s =>",$2} \ /^totals/ {printf "compressed radio:%.2f%\n", $6 * 100}' xz_pipe_mini.exe.xz =>compressed radio:30.00% |
1 2 3 4 5 6 | $ xz libwx_gtk2u_core-2.8.so.0.8.0 $ du -k libwx_gtk2u_core-2.8.so.0.8.0.xz 916 libwx_gtk2u_core-2.8.so.0.8.0.xz $ xz --x86 --lzma2 libwx_gtk2u_core-2.8.so.0.8.0 $ du -k libwx_gtk2u_core-2.8.so.0.8.0.xz 856 libwx_gtk2u_core-2.8.so.0.8.0.xz |
1 | $ xzcat test.txt.xz | wc -l ## count the lines of test.txt |
1 2 3 4 5 6 7 | $ xzgrep -P -n "lzma_\w+" xz_pipe_comp_mini.c.xz 8: lzma_check check = LZMA_CHECK_CRC64; 9: lzma_stream strm = LZMA_STREAM_INIT; /* alloc and init lzma_stream struct */ 15: lzma_easy_encoder (&strm, 6, LZMA_CHECK_CRC64); 28: lzma_action action = in_finished ? LZMA_FINISH : LZMA_RUN; 35: lzma_code (&strm, action); /* compress data */ 42: lzma_end (&strm); |
1 | "xzcat <file.xz> | less" 或 "xzcat <file.xz> | more" |
1 2 3 4 5 6 7 8 | $ xzdiff xz_pipe_comp_mini.c.orig.xz xz_pipe_comp_mini.c.xz 20c20 < if (feof (in_file)) --- > if (feof (in_file)) { 21a22 > } $ |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |