Linux操作系统的压缩、解压缩工具介绍
Linux操作系统的压缩、解压缩工具介绍
作者:尹正杰
版权声明:原创作品,谢绝转载!否则将追究法律责任。
一.compress/uncompress命令常用参数
Linux compress命令:
是一个相当古老的 unix 档案压缩指令,压缩后的档案会加上一个 .Z 延伸档名以区别未压缩的档案,压缩后的档案可以以 uncompress 解压。若要将数个档案压成一个压缩档,必须先将档案 tar 起来再压缩。由于 gzip 可以产生更理想的压缩比例,一般人多已改用 gzip 为档案压缩工具。 compress [-dfvcVr] [-b maxbits] [file ...]
-d:
解压缩,相当于uncompress
-c:
结果输出至标准输出,不删除原文件
-v:
显示详情 uncompress
解压缩 zcat file.Z >file
1>.安装commpress/uncompress软件包
[root@node101.yinzhengjie.org.cn ~]# yum -y install ncompress.x86_64
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* epel: mirrors.tuna.tsinghua.edu.cn
* extras: mirrors.aliyun.com
* updates: mirror.bit.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package ncompress.x86_64 :4.2.4.4-.el7 will be installed
--> Finished Dependency Resolution Dependencies Resolved ===================================================================================================================================
Package Arch Version Repository Size
===================================================================================================================================
Installing:
ncompress x86_64 4.2.4.4-.el7 base k Transaction Summary
===================================================================================================================================
Install Package Total download size: k
Installed size: k
Downloading packages:
ncompress-4.2.4.4-.el7.x86_64.rpm | kB ::
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : ncompress-4.2.4.4-.el7.x86_64 /
Verifying : ncompress-4.2.4.4-.el7.x86_64 / Installed:
ncompress.x86_64 :4.2.4.4-.el7 Complete!
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# yum -y install ncompress.x86_64
2>.压缩文件
[root@node101.yinzhengjie.org.cn ~]# ll /var/log/messages -h
-rw------- root root 89K Dec : /var/log/messages
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# for _ in `seq `;do cat /var/log/messages >> /root/message;done #创建测试压缩的文件
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll -h
total 87M
-rw-r--r-- root root 87M Dec : message
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# compress message #compress命令压缩文件后会将源文件删除,并在源文件名称后缀中多了一个".Z"
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll -h
total 18M
-rw-r--r-- root root 18M Dec : message.Z #文件的确是变小啦。
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]#
3>.解压文件
[root@node101.yinzhengjie.org.cn ~]# ll -h
total 18M
-rw-r--r-- root root 18M Dec : message.Z
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# uncompress message.Z
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll -h
total 87M
-rw-r--r-- root root 87M Dec : message
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]#
4>."-c"参数使用案例
[root@node101.yinzhengjie.org.cn ~]# ll -h
total 87M
-rw-r--r-- root root 87M Dec : message
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# compress -c message > message.Z #不建议将压缩结果直接输出到标准输出,因为打印在标准输出咱们人为是读不懂的,因此可以考虑重定向,这样即压缩来源文件,也达到来不删除源文件的好处。
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll -h
total 104M
-rw-r--r-- root root 87M Dec : message
-rw-r--r-- root root 18M Dec : message.Z
[root@node101.yinzhengjie.org.cn ~]#
5>.zcat使用案例
[root@node101.yinzhengjie.org.cn ~]# ll
total
-rw-r--r-- root root Dec : message
-rw-r--r-- root root Dec : message.Z
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# zcat message.Z #预览压缩内容但并不解压
......
Dec :: node101 systemd: Started Session of user root.
Dec :: node101 systemd: Removed slice User Slice of root.
Dec :: node101 systemd: Starting Cleanup of Temporary Directories...
Dec :: node101 systemd: Started Cleanup of Temporary Directories.
Dec :: node101 systemd: Created slice User Slice of root.
Dec :: node101 systemd: Started Session of user root.
Dec :: node101 systemd: Removed slice User Slice of root.
Dec :: node101 sshd[]: Accepted password for root from 172.30.1.2 port ssh2
Dec :: node101 systemd: Created slice User Slice of root.
Dec :: node101 systemd-logind: New session of user root.
Dec :: node101 systemd: Started Session of user root.
Dec :: node101 chronyd[]: Source 116.203.151.74 replaced with 119.28.183.184
Dec :: node101 chronyd[]: Selected source 119.28.183.184
Dec :: node101 chronyd[]: System clock wrong by 165882.562596 seconds, adjustment started
Dec :: node101 systemd: Started Session of user root.
Dec :: node101 chronyd[]: Source 144.76.76.107 replaced with 193.182.111.141
Dec :: node101 sshd[]: Accepted password for root from 172.30.1.2 port ssh2
Dec :: node101 systemd-logind: New session of user root.
Dec :: node101 systemd: Started Session of user root.
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll
total
-rw-r--r-- root root Dec : message
-rw-r--r-- root root Dec : message.Z
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# zcat message.Z #预览压缩内容但并不解压
6>.compress也支持交互式压缩
[root@node101.yinzhengjie.org.cn ~]# ll
total
-rw-r--r-- root root Dec : message
-rw-r--r-- root root Dec : message.Z
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# compress > test.Z #按住"ctrl+d"就会结束命令行输出
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll
total
-rw-r--r-- root root Dec : message
-rw-r--r-- root root Dec : message.Z
-rw-r--r-- root root Dec : test.Z
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# zcat test.Z | wc -c #重复的次数越多,压缩比例就越高 [root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll
total
-rw-r--r-- root root Dec : message
-rw-r--r-- root root Dec : message.Z
-rw-r--r-- root root Dec : test.Z
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]#
7>."-d"参数介绍
[root@node101.yinzhengjie.org.cn ~]# ll
total
-rw-r--r-- root root Dec : message
-rw-r--r-- root root Dec : message.Z
-rw-r--r-- root root Dec : test.Z
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# compress -d test.Z #解压"test.Z"文件
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll
total
-rw-r--r-- root root Dec : message
-rw-r--r-- root root Dec : message.Z
-rw-r--r-- root root Dec : test
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]#
8>.compress命令支持将命令标准输出进行压缩
[root@node101.yinzhengjie.org.cn ~]# dmesg | compress > dmesg.Z
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll
total
-rw-r--r-- root root Dec : dmesg.Z
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# uncompress dmesg.Z
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll
total
-rw-r--r-- root root Dec : dmesg
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]#
9>.更多compress压缩命令帮助信息
[root@node101.yinzhengjie.org.cn ~]# compress --help
Unknown flag: '-'; Usage: compress [-dfvcVr] [-b maxbits] [file ...]
-d If given, decompression is done instead.
-c Write output on stdout, don't remove original.
-b Parameter limits the max number of bits/code.
-f Forces output file to be generated, even if one already.
exists, and even if no space is saved by compressing.
If -f is not used, the user will be prompted if stdin is.
a tty, otherwise, the output file will not be overwritten.
-v Write compression statistics.
-V Output vesion and compile options.
-r Recursive. If a filename is a directory, descend
into it and compress everything in it.
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# compress --help
[root@node101.yinzhengjie.org.cn ~]# man compress
二.gzip/gunzip(gzip完胜compress)
gzip [OPTION]... FILE ...
-d:
解压缩,相当于gunzip
-c:
结果输出至标准输出,保留原文件不改变
-num:
这个"num"对应的数字范围是:1-,指定压缩比,值越大压缩比越大,默认压缩比例是6,可参考下面的实验结果。
zcat:
不显式解压缩的前提下查看文本文件内容
1>.压缩同样文件对比compress和gzip的压缩比例
[root@node101.yinzhengjie.org.cn ~]# for _ in `seq `;do cat /var/log/messages >> /root/message;done
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll -h
total 877M
-rw-r--r-- root root 877M Dec : message
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# cp message f1.txt
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# cp message f2.txt
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll -h
total .6G
-rw-r--r-- root root 877M Dec : f1.txt
-rw-r--r-- root root 877M Dec : f2.txt
-rw-r--r-- root root 877M Dec : message
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# compress f1.txt
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# gzip f2.txt
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll -h
total .2G
-rw-r--r-- root root 171M Dec : f1.txt.Z
-rw-r--r-- root root 164M Dec : f2.txt.gz
-rw-r--r-- root root 877M Dec : message
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]#
2>.解压文件
[root@node101.yinzhengjie.org.cn ~]# ll -h
total .2G
-rw-r--r-- root root 171M Dec : f1.txt.Z
-rw-r--r-- root root 164M Dec : f2.txt.gz
-rw-r--r-- root root 877M Dec : message
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# gunzip f2.txt.gz
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll -h
total .9G
-rw-r--r-- root root 171M Dec : f1.txt.Z
-rw-r--r-- root root 877M Dec : f2.txt
-rw-r--r-- root root 877M Dec : message
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]#
3>.指定压缩级别(默认压缩级别在6左右)
[root@node101.yinzhengjie.org.cn ~]# ll -h
total 768M
-rw-r--r--. root root 768M Dec : message
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# cp message f1.txt
[root@node101.yinzhengjie.org.cn ~]# cp message f2.txt
[root@node101.yinzhengjie.org.cn ~]# cp message f3.txt
[root@node101.yinzhengjie.org.cn ~]# cp message f4.txt
[root@node101.yinzhengjie.org.cn ~]# cp message f5.txt
[root@node101.yinzhengjie.org.cn ~]# cp message f6.txt
[root@node101.yinzhengjie.org.cn ~]# cp message f7.txt
[root@node101.yinzhengjie.org.cn ~]# cp message f8.txt
[root@node101.yinzhengjie.org.cn ~]# cp message f9.txt
[root@node101.yinzhengjie.org.cn ~]# cp message f10.txt
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll -h
total .3G
-rw-r--r--. root root 768M Dec : f10.txt
-rw-r--r--. root root 768M Dec : f1.txt
-rw-r--r--. root root 768M Dec : f2.txt
-rw-r--r--. root root 768M Dec : f3.txt
-rw-r--r--. root root 768M Dec : f4.txt
-rw-r--r--. root root 768M Dec : f5.txt
-rw-r--r--. root root 768M Dec : f6.txt
-rw-r--r--. root root 768M Dec : f7.txt
-rw-r--r--. root root 768M Dec : f8.txt
-rw-r--r--. root root 768M Dec : f9.txt
-rw-r--r--. root root 768M Dec : message
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# gzip - f1.txt
[root@node101.yinzhengjie.org.cn ~]# gzip - f2.txt
[root@node101.yinzhengjie.org.cn ~]# gzip - f3.txt
[root@node101.yinzhengjie.org.cn ~]# gzip - f4.txt
[root@node101.yinzhengjie.org.cn ~]# gzip - f5.txt
[root@node101.yinzhengjie.org.cn ~]# gzip - f6.txt
[root@node101.yinzhengjie.org.cn ~]# gzip - f7.txt
[root@node101.yinzhengjie.org.cn ~]# gzip - f8.txt
[root@node101.yinzhengjie.org.cn ~]# gzip - f9.txt
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# gzip f10.txt
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll -h
total .3G
-rw-r--r--. root root 149M Dec : f10.txt.gz
-rw-r--r--. root root 173M Dec : f1.txt.gz
-rw-r--r--. root root 168M Dec : f2.txt.gz
-rw-r--r--. root root 166M Dec : f3.txt.gz
-rw-r--r--. root root 154M Dec : f4.txt.gz
-rw-r--r--. root root 151M Dec : f5.txt.gz
-rw-r--r--. root root 149M Dec : f6.txt.gz
-rw-r--r--. root root 148M Dec : f7.txt.gz
-rw-r--r--. root root 146M Dec : f8.txt.gz
-rw-r--r--. root root 146M Dec : f9.txt.gz
-rw-r--r--. root root 768M Dec : message
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]#
4>."-c"选项使用案例
[root@node101.yinzhengjie.org.cn ~]# ll -h
total 768M
-rw-r--r--. root root 768M Dec : message
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# gzip -c message > message.gz #结果输出至标准输出,保留原文件不改变
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll -h
total 917M
-rw-r--r--. root root 768M Dec : message
-rw-r--r--. root root 149M Dec : message.gz
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]#
5>.查看gzip的帮助信息
[root@node101.yinzhengjie.org.cn ~]# gzip --help
Usage: gzip [OPTION]... [FILE]...
Compress or uncompress FILEs (by default, compress FILES in-place). Mandatory arguments to long options are mandatory for short options too. -c, --stdout write on standard output, keep original files unchanged
-d, --decompress decompress
-f, --force force overwrite of output file and compress links
-h, --help give this help
-l, --list list compressed file contents
-L, --license display software license
-n, --no-name do not save or restore the original name and time stamp
-N, --name save or restore the original name and time stamp
-q, --quiet suppress all warnings
-r, --recursive operate recursively on directories
-S, --suffix=SUF use suffix SUF on compressed files
-t, --test test compressed file integrity
-v, --verbose verbose mode
-V, --version display version number
-, --fast compress faster
-, --best compress better
--rsyncable Make rsync-friendly archive With no FILE, or when FILE is -, read standard input. Report bugs to <bug-gzip@gnu.org>.
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# gzip --help
[root@node101.yinzhengjie.org.cn ~]# man gzip
三.bzip2/bunzip2/bzcat(功能要比gzip压缩还要强,比如httpd官方网站的很多压缩包都是基于bzip2压缩方式的,缺点就是压缩时间较长)
bzip2 [OPTION]... FILE ...
-k:keep,
保留原文件
-d:
解压缩
-#:-,
压缩比,默认为9
bzcat:
不显式解压缩的前提下查看文本文件内容
1>.安装bzip2软件包
[root@node101.yinzhengjie.org.cn ~]# yum -y install bzip2
Loaded plugins: fastestmirror
Determining fastest mirrors
* base: mirror.bit.edu.cn
* extras: mirror.bit.edu.cn
* updates: mirrors.tuna.tsinghua.edu.cn
base | 3.6 kB ::
extras | 2.9 kB ::
updates | 2.9 kB ::
(/): base//x86_64/group_gz | kB ::
(/): extras//x86_64/primary_db | kB ::
(/): base//x86_64/primary_db | 6.0 MB ::
(/): updates//x86_64/primary_db | 5.8 MB ::
Resolving Dependencies
--> Running transaction check
---> Package bzip2.x86_64 :1.0.-.el7 will be installed
--> Finished Dependency Resolution Dependencies Resolved ===================================================================================================================================
Package Arch Version Repository Size
===================================================================================================================================
Installing:
bzip2 x86_64 1.0.-.el7 base k Transaction Summary
===================================================================================================================================
Install Package Total download size: k
Installed size: k
Downloading packages:
bzip2-1.0.-.el7.x86_64.rpm | kB ::
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : bzip2-1.0.-.el7.x86_64 /
Verifying : bzip2-1.0.-.el7.x86_64 / Installed:
bzip2.x86_64 :1.0.-.el7 Complete!
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# yum -y install bzip2
2>.bzip2对比gzip最好压缩比例
[root@node101.yinzhengjie.org.cn ~]# ll
total
-rw-r--r--. root root Dec : message
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# cp message f1.txt
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# cp message f2.txt
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll -h
total .3G
-rw-r--r--. root root 768M Dec : f1.txt
-rw-r--r--. root root 768M Dec : f2.txt
-rw-r--r--. root root 768M Dec : message
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# gzip - f1.txt
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# bzip2 f2.txt
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll -h
total 937M
-rw-r--r--. root root 146M Dec : f1.txt.gz
-rw-r--r--. root root 23M Dec : f2.txt.bz2
-rw-r--r--. root root 768M Dec : message
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]#
3>."-k"参数使用案例
[root@node101.yinzhengjie.org.cn ~]# ll -h
total 768M
-rw-r--r--. root root 768M Dec : message
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# bzip2 -k message #压缩时并不会删除源文件
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll -h
total 791M
-rw-r--r--. root root 768M Dec : message
-rw-r--r--. root root 23M Dec : message.bz2
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]#
4>."-d"参数介绍
[root@node101.yinzhengjie.org.cn ~]# ll
total
-rw-r--r--. root root Dec : message.bz2
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# bzip2 -d message.bz2
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll -h
total 768M
-rw-r--r--. root root 768M Dec : message
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll
total
-rw-r--r--. root root Dec : message
[root@node101.yinzhengjie.org.cn ~]#
5>.bzcat命令可以查看bzip2压缩后的文件
[root@node101.yinzhengjie.org.cn ~]# ll
total
-rw-r--r--. root root Dec : message
-rw-r--r--. root root Dec : message.bz2
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# bzcat message.bz2 #在不解压缩的前提下查看文件内容
Dec :: node101 kernel: pci ::01.0: PCI bridge to [bus ]
Dec :: node101 kernel: pci ::01.0: bridge window [io 0x6000-0x7fff]
Dec :: node101 kernel: pci ::01.0: bridge window [mem 0xe2000000-0xedffffff]
Dec :: node101 kernel: pci ::01.0: bridge window [mem 0xb0000000-0xdfffffff 64bit pref]
Dec :: node101 kernel: pci ::0a.: PCI bridge to [bus ]
.......
6>.查看帮助信息
[root@node101.yinzhengjie.org.cn ~]# bzip2 --help
bzip2, a block-sorting file compressor. Version 1.0., -Sept-. usage: bzip2 [flags and input files in any order] -h --help print this message
-d --decompress force decompression
-z --compress force compression
-k --keep keep (don't delete) input files
-f --force overwrite existing output files
-t --test test compressed file integrity
-c --stdout output to standard out
-q --quiet suppress noncritical error messages
-v --verbose be verbose (a 2nd -v gives more)
-L --license display software version & license
-V --version display software version & license
-s --small use less memory (at most 2500k)
- .. - set block size to 100k .. 900k
--fast alias for -
--best alias for - If invoked as `bzip2', default action is to compress.
as `bunzip2', default action is to decompress.
as `bzcat', default action is to decompress to stdout. If no file names are given, bzip2 compresses or decompresses
from standard input to standard output. You can combine
short flags, so `-v -' means the same as -v4 or -4v, &c. [root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# bzip2 --help
[root@node101.yinzhengjie.org.cn ~]# man bzip2
四.xz/unxz/xzcat(压缩比上面几种压缩比例都强,linux 内核软件包官方使用的就是这种压缩方式)
xz [OPTION]... FILE ...
-k: keep
保留原文件
-d:
解压缩
-num:
-,压缩比,默认为6 unxz file.xz 解压缩
xzcat:
不显式解压缩的前提下查看文本文件内容
1>."-k"参数使用案例
[root@node101.yinzhengjie.org.cn ~]# ll -h
total 768M
-rw-r--r--. root root 768M Dec : message
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll
total
-rw-r--r--. root root Dec : message
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# xz -k message #压缩时可以保存源文件
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll
total
-rw-r--r--. root root Dec : message
-rw-r--r--. root root Dec : message.xz
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll -h
total 768M
-rw-r--r--. root root 768M Dec : message
-rw-r--r--. root root 129K Dec : message.xz
[root@node101.yinzhengjie.org.cn ~]#
2>."-d"参数使用案例
[root@node101.yinzhengjie.org.cn ~]# ll
total
-rw-r--r--. root root Dec : message.log
-rw-r--r--. root root Dec : message.xz
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# xz -d message.xz #解压文件
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll
total
-rw-r--r--. root root Dec : message
-rw-r--r--. root root Dec : message.log
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]#
3>.压缩比例对比(随着压缩的比例越大,耗费的时间就越长,默认为6)
[root@node101.yinzhengjie.org.cn ~]# ll -h
total 768M
-rw-r--r--. root root 768M Dec : message
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# cp message f1.txt
[root@node101.yinzhengjie.org.cn ~]# cp message f2.txt
[root@node101.yinzhengjie.org.cn ~]# cp message f3.txt
[root@node101.yinzhengjie.org.cn ~]# cp message f4.txt
[root@node101.yinzhengjie.org.cn ~]# cp message f5.txt
[root@node101.yinzhengjie.org.cn ~]# cp message f6.txt
[root@node101.yinzhengjie.org.cn ~]# cp message f7.txt
[root@node101.yinzhengjie.org.cn ~]# cp message f8.txt
[root@node101.yinzhengjie.org.cn ~]# cp message f9.txt
[root@node101.yinzhengjie.org.cn ~]# cp message f10.txt
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll -h
total .5G
-rw-r--r--. root root 768M Dec : f10.txt
-rw-r--r--. root root 768M Dec : f1.txt
-rw-r--r--. root root 768M Dec : f2.txt
-rw-r--r--. root root 768M Dec : f3.txt
-rw-r--r--. root root 768M Dec : f4.txt
-rw-r--r--. root root 768M Dec : f5.txt
-rw-r--r--. root root 768M Dec : f6.txt
-rw-r--r--. root root 768M Dec : f7.txt
-rw-r--r--. root root 768M Dec : f8.txt
-rw-r--r--. root root 768M Dec : f9.txt
-rw-r--r--. root root 768M Dec : message
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# xz - f1.txt
[root@node101.yinzhengjie.org.cn ~]# xz - f2.txt
[root@node101.yinzhengjie.org.cn ~]# xz - f3.txt
[root@node101.yinzhengjie.org.cn ~]# xz - f4.txt
[root@node101.yinzhengjie.org.cn ~]# xz - f5.txt
[root@node101.yinzhengjie.org.cn ~]# xz - f6.txt
[root@node101.yinzhengjie.org.cn ~]# xz - f7.txt
[root@node101.yinzhengjie.org.cn ~]# xz - f8.txt
[root@node101.yinzhengjie.org.cn ~]# xz - f9.txt
[root@node101.yinzhengjie.org.cn ~]# xz f10.txt
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll -h
total 769M
-rw-r--r--. root root 129K Dec : f10.txt.xz
-rw-r--r--. root root 129K Dec : f1.txt.xz
-rw-r--r--. root root 129K Dec : f2.txt.xz
-rw-r--r--. root root 129K Dec : f3.txt.xz
-rw-r--r--. root root 129K Dec : f4.txt.xz
-rw-r--r--. root root 129K Dec : f5.txt.xz
-rw-r--r--. root root 129K Dec : f6.txt.xz
-rw-r--r--. root root 129K Dec : f7.txt.xz
-rw-r--r--. root root 129K Dec : f8.txt.xz
-rw-r--r--. root root 129K Dec : f9.txt.xz
-rw-r--r--. root root 768M Dec : message
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll #最好以字节显示,不然真看不出差别了
total
-rw-r--r--. root root Dec : f10.txt.xz
-rw-r--r--. root root Dec : f1.txt.xz
-rw-r--r--. root root Dec : f2.txt.xz
-rw-r--r--. root root Dec : f3.txt.xz
-rw-r--r--. root root Dec : f4.txt.xz
-rw-r--r--. root root Dec : f5.txt.xz
-rw-r--r--. root root Dec : f6.txt.xz
-rw-r--r--. root root Dec : f7.txt.xz
-rw-r--r--. root root Dec : f8.txt.xz
-rw-r--r--. root root Dec : f9.txt.xz
-rw-r--r--. root root Dec : message
[root@node101.yinzhengjie.org.cn ~]#
五.zip/unzip
1>.安装zip/unzip工具
[root@node101.yinzhengjie.org.cn ~]# yum -y install zip unzip
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.huaweicloud.com
* extras: mirrors.huaweicloud.com
* updates: mirrors.tuna.tsinghua.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package unzip.x86_64 :6.0-.el7 will be installed
---> Package zip.x86_64 :3.0-.el7 will be installed
--> Finished Dependency Resolution Dependencies Resolved =================================================================================================================================
Package Arch Version Repository Size
=================================================================================================================================
Installing:
unzip x86_64 6.0-.el7 base k
zip x86_64 3.0-.el7 base k Transaction Summary
=================================================================================================================================
Install Packages Total download size: k
Installed size: 1.1 M
Downloading packages:
(/): unzip-6.0-.el7.x86_64.rpm | kB ::
(/): zip-3.0-.el7.x86_64.rpm | kB ::
---------------------------------------------------------------------------------------------------------------------------------
Total 2.2 MB/s | kB ::
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : zip-3.0-.el7.x86_64 /
Installing : unzip-6.0-.el7.x86_64 /
Verifying : unzip-6.0-.el7.x86_64 /
Verifying : zip-3.0-.el7.x86_64 / Installed:
unzip.x86_64 :6.0-.el7 zip.x86_64 :3.0-.el7 Complete!
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# yum -y install zip unzip
2>.打包并压缩文件文件目录
[root@node101.yinzhengjie.org.cn ~]# ll
total
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# zip -r ./sysconfig.log /etc/sysconfig/ #将"/etc/sysconfig"目录的所有文件(递归)打包到当前目录下的一个叫"sysconfig.log"的文件。
adding: etc/sysconfig/ (stored %)
adding: etc/sysconfig/cpupower (deflated %)
adding: etc/sysconfig/man-db (deflated %)
adding: etc/sysconfig/grub (deflated %)
adding: etc/sysconfig/cbq/ (stored %)
adding: etc/sysconfig/cbq/cbq-.example (deflated %)
adding: etc/sysconfig/cbq/avpkt (stored %)
adding: etc/sysconfig/wpa_supplicant (deflated %)
adding: etc/sysconfig/run-parts (stored %)
adding: etc/sysconfig/network-scripts/ (stored %)
adding: etc/sysconfig/network-scripts/ifup-isdn (deflated %)
adding: etc/sysconfig/network-scripts/ifdown-Team (deflated %)
adding: etc/sysconfig/network-scripts/ifdown-ipv6 (deflated %)
adding: etc/sysconfig/network-scripts/ifdown-tunnel (deflated %)
adding: etc/sysconfig/network-scripts/ifup-wireless (deflated %)
adding: etc/sysconfig/network-scripts/ifcfg-lo (deflated %)
adding: etc/sysconfig/network-scripts/ifup-plip (deflated %)
adding: etc/sysconfig/network-scripts/init.ipv6-global (deflated %)
adding: etc/sysconfig/network-scripts/ifup-ipv6 (deflated %)
adding: etc/sysconfig/network-scripts/ifup-bnep (deflated %)
adding: etc/sysconfig/network-scripts/ifdown-isdn (deflated %)
adding: etc/sysconfig/network-scripts/ifup-ippp (deflated %)
adding: etc/sysconfig/network-scripts/ifdown-ippp (deflated %)
adding: etc/sysconfig/network-scripts/ifup-eth (deflated %)
adding: etc/sysconfig/network-scripts/ifup-routes (deflated %)
adding: etc/sysconfig/network-scripts/ifup-ppp (deflated %)
adding: etc/sysconfig/network-scripts/ifup-sit (deflated %)
adding: etc/sysconfig/network-scripts/ifdown-TeamPort (deflated %)
adding: etc/sysconfig/network-scripts/ifdown-ppp (deflated %)
adding: etc/sysconfig/network-scripts/ifdown-bnep (deflated %)
adding: etc/sysconfig/network-scripts/ifdown-post (deflated %)
adding: etc/sysconfig/network-scripts/network-functions (deflated %)
adding: etc/sysconfig/network-scripts/ifup-TeamPort (deflated %)
adding: etc/sysconfig/network-scripts/ifcfg-eth0 (deflated %)
adding: etc/sysconfig/network-scripts/ifup-post (deflated %)
adding: etc/sysconfig/network-scripts/ifup-plusb (deflated %)
adding: etc/sysconfig/network-scripts/ifdown-eth (deflated %)
adding: etc/sysconfig/network-scripts/ifup-Team (deflated %)
adding: etc/sysconfig/network-scripts/network-functions-ipv6 (deflated %)
adding: etc/sysconfig/network-scripts/ifdown-sit (deflated %)
adding: etc/sysconfig/network-scripts/ifdown-routes (deflated %)
adding: etc/sysconfig/network-scripts/ifup (deflated %)
adding: etc/sysconfig/network-scripts/ifup-tunnel (deflated %)
adding: etc/sysconfig/network-scripts/ifdown (deflated %)
adding: etc/sysconfig/network-scripts/ifup-aliases (deflated %)
adding: etc/sysconfig/console/ (stored %)
adding: etc/sysconfig/ip6tables-config (deflated %)
adding: etc/sysconfig/sshd (deflated %)
adding: etc/sysconfig/ebtables-config (deflated %)
adding: etc/sysconfig/authconfig (deflated %)
adding: etc/sysconfig/firewalld (stored %)
adding: etc/sysconfig/init (deflated %)
adding: etc/sysconfig/modules/ (stored %)
adding: etc/sysconfig/rsyslog (deflated %)
adding: etc/sysconfig/network (stored %)
adding: etc/sysconfig/netconsole (deflated %)
adding: etc/sysconfig/anaconda (deflated %)
adding: etc/sysconfig/irqbalance (deflated %)
adding: etc/sysconfig/selinux (deflated %)
adding: etc/sysconfig/chronyd (stored %)
adding: etc/sysconfig/readonly-root (deflated %)
adding: etc/sysconfig/iptables-config (deflated %)
adding: etc/sysconfig/crond (deflated %)
adding: etc/sysconfig/rdisc (stored %)
adding: etc/sysconfig/kdump (deflated %)
adding: etc/sysconfig/kernel (deflated %)
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll
total
-rw-r--r--. root root Dec : sysconfig.log
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# zip -r ./sysconfig.log /etc/sysconfig/ #将"/etc/sysconfig"目录的所有文件(递归)打包到当前目录下的一个叫"sysconfig.log"的文件。
3>.解包压缩文件
[root@node101.yinzhengjie.org.cn ~]# ll
total
-rw-r--r--. root root Dec : sysconfig.log
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# unzip sysconfig.log #解包压缩文件
Archive: sysconfig.log
creating: etc/sysconfig/
inflating: etc/sysconfig/cpupower
inflating: etc/sysconfig/man-db
inflating: etc/sysconfig/grub
creating: etc/sysconfig/cbq/
inflating: etc/sysconfig/cbq/cbq-.example
extracting: etc/sysconfig/cbq/avpkt
inflating: etc/sysconfig/wpa_supplicant
extracting: etc/sysconfig/run-parts
creating: etc/sysconfig/network-scripts/
inflating: etc/sysconfig/network-scripts/ifup-isdn
inflating: etc/sysconfig/network-scripts/ifdown-Team
inflating: etc/sysconfig/network-scripts/ifdown-ipv6
inflating: etc/sysconfig/network-scripts/ifdown-tunnel
inflating: etc/sysconfig/network-scripts/ifup-wireless
inflating: etc/sysconfig/network-scripts/ifcfg-lo
inflating: etc/sysconfig/network-scripts/ifup-plip
inflating: etc/sysconfig/network-scripts/init.ipv6-global
inflating: etc/sysconfig/network-scripts/ifup-ipv6
inflating: etc/sysconfig/network-scripts/ifup-bnep
inflating: etc/sysconfig/network-scripts/ifdown-isdn
inflating: etc/sysconfig/network-scripts/ifup-ippp
inflating: etc/sysconfig/network-scripts/ifdown-ippp
inflating: etc/sysconfig/network-scripts/ifup-eth
inflating: etc/sysconfig/network-scripts/ifup-routes
inflating: etc/sysconfig/network-scripts/ifup-ppp
inflating: etc/sysconfig/network-scripts/ifup-sit
inflating: etc/sysconfig/network-scripts/ifdown-TeamPort
inflating: etc/sysconfig/network-scripts/ifdown-ppp
inflating: etc/sysconfig/network-scripts/ifdown-bnep
inflating: etc/sysconfig/network-scripts/ifdown-post
inflating: etc/sysconfig/network-scripts/network-functions
inflating: etc/sysconfig/network-scripts/ifup-TeamPort
inflating: etc/sysconfig/network-scripts/ifcfg-eth0
inflating: etc/sysconfig/network-scripts/ifup-post
inflating: etc/sysconfig/network-scripts/ifup-plusb
inflating: etc/sysconfig/network-scripts/ifdown-eth
inflating: etc/sysconfig/network-scripts/ifup-Team
inflating: etc/sysconfig/network-scripts/network-functions-ipv6
inflating: etc/sysconfig/network-scripts/ifdown-sit
inflating: etc/sysconfig/network-scripts/ifdown-routes
inflating: etc/sysconfig/network-scripts/ifup
inflating: etc/sysconfig/network-scripts/ifup-tunnel
inflating: etc/sysconfig/network-scripts/ifdown
inflating: etc/sysconfig/network-scripts/ifup-aliases
creating: etc/sysconfig/console/
inflating: etc/sysconfig/ip6tables-config
inflating: etc/sysconfig/sshd
inflating: etc/sysconfig/ebtables-config
inflating: etc/sysconfig/authconfig
extracting: etc/sysconfig/firewalld
inflating: etc/sysconfig/init
creating: etc/sysconfig/modules/
inflating: etc/sysconfig/rsyslog
extracting: etc/sysconfig/network
inflating: etc/sysconfig/netconsole
inflating: etc/sysconfig/anaconda
inflating: etc/sysconfig/irqbalance
inflating: etc/sysconfig/selinux
extracting: etc/sysconfig/chronyd
inflating: etc/sysconfig/readonly-root
inflating: etc/sysconfig/iptables-config
inflating: etc/sysconfig/crond
extracting: etc/sysconfig/rdisc
inflating: etc/sysconfig/kdump
inflating: etc/sysconfig/kernel
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll
total
drwxr-xr-x. root root Dec : etc
-rw-r--r--. root root Dec : sysconfig.log
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# du -sh etc
384K etc
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll -h
total 80K
drwxr-xr-x. root root .0K Dec : etc
-rw-r--r--. root root 75K Dec : sysconfig.log
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# unzip sysconfig.log #解包压缩文件
4>.将系统日志的内容压缩
[root@node101.yinzhengjie.org.cn ~]# ll /var/log/messages
-rw-------. root root Dec : /var/log/messages
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll -h /var/log/messages
-rw-------. root root 302K Dec : /var/log/messages
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll
total
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# cat /var/log/messages | zip messages - #将系统日志的内容进行压缩处理并在当前目录生成一个"messages.zip"的文件
adding: - (deflated %)
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll
total
-rw-r--r--. root root Dec : messages.zip
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll -h
total 60K
-rw-r--r--. root root 59K Dec : messages.zip
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# cat /var/log/messages | zip messages - #将系统日志的内容进行压缩处理并在当前目录生成一个"messages.zip"的文件
5>.解包解压缩
[root@node101.yinzhengjie.org.cn ~]# ll
total
-rw-r--r--. root root Dec : messages.zip
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# unzip -p messages.zip > messages #解压文件内容并重定向到当前目录到"messages"文件中。
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll
total
-rw-r--r--. root root Dec : messages
-rw-r--r--. root root Dec : messages.zip
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# unzip -p messages.zip > messages #解压文件内容并重定向到当前目录到"messages"文件中。
Linux操作系统的压缩、解压缩工具介绍的更多相关文章
- Linux操作系统的打包/归档工具介绍
Linux操作系统的打包/归档工具介绍 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任.
- Linux操作系统的文件查找工具locate和find命令常用参数介绍
Linux操作系统的文件查找工具locate和find命令常用参数介绍 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.非实时查找(数据库查找)locate工具 locate命 ...
- Linux的压缩/解压缩文件处理 zip & unzip
Linux的压缩/解压缩命令详解及实例 压缩服务器上当前目录的内容为xxx.zip文件 zip -r xxx.zip ./* 解压zip文件到当前目录 unzip filename.zip 另:有些服 ...
- Rsync,Linux日志及Screen工具介绍
第十六次课 Rsync,Linux日志及Screen工具介绍 目录 一.rsync工具介绍 二.rsync常用选项 三.rsync通过ssh同步 四. rsync通过服务同步 五.linux系统日志 ...
- Linux 文件内容查看工具介绍-cat,less,more,tail,head
Linux 文件内容查看工具介绍 作者:北南南北来自:LinuxSir.Org摘要: 本文讲述几种常用文件内容的查看工具,比如cat.more.less.head.tail等,把这些工具最常用的参数. ...
- Linux 之 压缩解压缩
Linux中常见的压缩格式 .zip .gz .bz2 .tar.gz tar.bz2 zip zip格式的压缩文件和win ...
- 【Linux】文本处理工具介绍
文本处理工具介绍 grep.sed和awk都是文本处理工具,各自都有各自的优缺点,一种文本处理命令是不能被另一个完全替换的.相比较而言,sed和awk功能更强大,且已独立成一种语言来介绍. grep: ...
- Linux之rsync同步工具介绍+inotify同步
1.rsync介绍 Rsync是一款开源的.快速的.多功能的.可实现全量及增量的本地或远程数据同步备份的优秀工具.Rsync软件适用于unix/linux/windows等多种操作平台. rsync, ...
- Linux下的下载工具介绍----aria2
ariac 项目地址:http://aria2.sourceforge.net/ 下载地址:http://sourceforge.net/projects/aria2/files/stable/ari ...
随机推荐
- Today's missions
A software for recording events and tasks. You can add, delete and edit tasks anytime, anywhere, eas ...
- Spring Cloud微服务安全实战_3-5_API安全之常见问题
1,数据校验,解决接口层的参数校验,是api安全的前线.可以用JSR303注解进行接口层面的校验 ,参考文章:https://www.ibm.com/developerworks/cn/java/j- ...
- Linux性能优化实战学习笔记:第四十七讲
一.上节回顾 上一节,我们梳理了,应用程序容器化后性能下降的分析方法.一起先简单回顾下.容器利用 Linux 内核提供的命名空间技术,将不同应用程序的运行隔离起来,并用统一的镜像,来管理应用程序的依赖 ...
- MySQL实战45讲学习笔记:第七讲
一.上节回顾今日计划 在上一篇文章中,我跟你介绍了 MySQL 的全局锁和表级锁,今天我们就来讲讲 MySQL的行锁. MySQL 的行锁是在引擎层由各个引擎自己实现的.但并不是所有的引擎都支持行锁, ...
- [LeetCode] 743. Network Delay Time 网络延迟时间
There are N network nodes, labelled 1 to N. Given times, a list of travel times as directededges tim ...
- [LeetCode] 623. Add One Row to Tree 二叉树中增加一行
Given the root of a binary tree, then value v and depth d, you need to add a row of nodes with value ...
- DVWA SQL Injection(Blind) 通关教程
SQL Injection(Blind),即SQL盲注,与一般注入的区别在于,一般的注入攻击者可以直接从页面上看到注入语句的执行结果,而盲注时攻击者通常是无法从显示页面上获取执行结果,甚至连注入语句是 ...
- FWT-快速沃尔什变换
FWT-快速沃尔什变换 FWT有啥用啊 我们知道,FFT可以解决多项式的卷积,即 \[ C_k=\sum_{i+j=k}A_i*B_j \] 如果将操作符换一下,换成集合运算符 比如 \[ C_k=\ ...
- Unity C# File类 本地数据保存和游戏存档
进行本地数据存档和载入在游戏开发中非常常见,几乎任何一款游戏都需要这样的功能. 命名空间: using System.IO; 主要用于引入File类以处理各类文件操作. using System.Ru ...
- springboot 解决Jackson导致Long型数据精度丢失问题
代码中注入一个bean即可: /** * 解决Jackson导致Long型数据精度丢失问题 * * @return */ @Bean("jackson2ObjectMapperBuilder ...