tar打包
tar 参数 /路径/压缩包名字 文件或目录名
tar 参数 /路径/压缩包名字 选项 /释放的位置
-c:创建新的压缩
-x:从压缩包内提取文件
-f:指定归档文件名称,必须在所有选项的最后
-z:调用.gzip格式工具进行处理.gz
-j:调用.bzip2格式工具进行处理.bz2
-J:调用.xz格式工具进行处理.xz
-t:显示压缩包的内容
-C:解压缩到指定目录
-v:显示执行过程详细信息
-w:确认压缩包的完整性
--exclude:排除部分数据信息不要进行压缩
[root@linuxcool ~]# tar -zcvf /root/xixi.tar.gz /etc/passwd /home
[root@linuxcool ~]# tar -tvf /root/xixi.tar.gz #查看tar包内容
[root@linuxcool ~]# tar zcf /tmp/etc-pai.tar.gz /etc/ --exclude=/etc/services
[root@linuxcool ~]# tar cvf File.tar *.cfg
anaconda-ks.cfg
[root@linuxcool ~]# tar cvf File.tar *.cfg --remove-files
anaconda-ks.cfg
[root@linuxcool ~]# tar xvf File.tar
anaconda-ks.cfg
[root@linuxcool ~]# tar xvf File.tar -C /etc
anaconda-ks.cfg
[root@linuxcool ~]# tar tvf File.tar
-rw------- root/root 1256 2023-05-18 08:42 anaconda-ks.cfg
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通