压缩解压
1.Linux系统基础2.Linux系统三种安装方式3.vim基础4.查询文件命令5.编辑网络配置文件6.vimtutor总结7.建立yum仓库8.Linux系统用户创建及权限9.Linux磁盘分盘10.自动挂载11.Linux系统安装程序---编译安装并加入systemd中12.计算机网络的参考模型13.IP地址14.交换机15.路由器16.VLAN17.不同vlan通信连接18.VRRP协议19.ACL与NAT20.网络部份考题21.Linux基础22.Linux命令注解23.目录命令24.操作命令
25.压缩解压
26.显示命令27.查询命令28.RIAD配置摘要29.系统启动引导30.进程以及其有关命令31.问题解析32.系统安全33.日志34.脚本大纲35.文本编辑器36.常用脚本37.LAMP38.LNMP39.nginx使用40.LVS集群41.Keepalived应用42.Tomcat43.自动化部署ansible44.Haproxy反向代理45.安装MySQLgzip bzip2
gzip | bzip2 | |
---|---|---|
压缩 | gzip [-9] 文件名… | bzip2 [-9] 文件名... |
解压 | gzip -d .gz格式的压缩文件 | bzip2 -d .bz2格式的压缩文件 |
注 | 提高压缩比例,但是文件较大时效率会低 |
9代表压缩比率,9最大1最小,默认为9
使用以上两种压缩不保留源文件
gzip的压缩率要高于bzip2
因为只能对文件操作所以基本不使用
[root@localhost best]# ls
head id passwd password QQ tail vimtutor
[root@localhost best]# gzip passwd
[root@localhost best]# ls
head id passwd.gz password QQ tail vimtutor
[root@localhost best]# gzip -d .gz
[root@localhost best]# ls
head id passwd password QQ tail vimtutor
[root@localhost best]# ls
head id passwd password QQ tail vimtutor
[root@localhost best]# bzip2 passwd
[root@localhost best]# ls
head id passwd.bz2 password QQ tail vimtutor
[root@localhost best]# bzip2 -d passwd.bz2
[root@localhost best]# ls
head id passwd password QQ tail vimtutor
tar
格式:
压缩:tar [选项] ... 归档文件名 源文件或目录
解压:tar [选项] ... 归档文件名 [-C 目标目录]
- -c:创建(Create).tar 格式的包文件
- -x:解开.tar 格式的包文件
- -C:解压时指定释放的目标文件夹
- -f:表示使用归档文件(一般都要带上表示使用tar)
- -p:打包时保留文件及目录的权限
- -P:打包时保留文件及目录的绝对径
- -t:列表查看包内的文件(要和f一起使用)
- -v:输出详细信息(Verbose)
- -j:调用 bzip2 程序进行压缩或解压
- -z:调用 gzip 程序进行压缩或解压
压缩文件(-j与-z用法相同)
[root@localhost best]# ls
head id list passwd password QQ tail vimtutor
[root@localhost best]# rm -rf list
[root@localhost best]# ls
head id passwd password QQ tail vimtutor
[root@localhost best]# tar -zcvf list.tar.gz id password QQ
id
password
QQ
[root@localhost best]# ls
head id list.tar.gz passwd password QQ tail vimtutor
解压(-j与-z可加可不加)
[root@localhost best]# ls
head id list.tar.gz passwd password QQ tail vimtutor
[root@localhost best]# tar xvf list.tar.gz -C /opt
id
password
QQ
[root@localhost best]# ls /opt
id nginx-1.18.0 nginx-1.18.0.tar.gz password QQ rh
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律