Linux系统下正确使用tar命令的操作方法
时间:2023-01-06 14:10:26
众所周知,Linux系统下tar命令打包文件,把几个不同的文件集合在同一个文件中,跟压缩软件的功能有点类似。但是很多用户不知道如何操作,下面,我们就一起来看看Linux系统下正确使用tar命令的操作方法。
Linux系统
tar [-cxtzjvfpPN] 文件与目录
-c :建立一个压缩文件-x :解开一个压缩文件-t :查看压缩文件的有哪些文件名
-j : 以bzip2进行压缩或解压缩,文件名为*.tar.bz2.
-z : 以gzip进行压缩或解压缩,文件名为*.tar.gz
-v : 压缩的过程中显示文件名
-f :后解被处理的文件名,只能放在参数末尾
-p :使用原文件的原来属性(属性不会依据使用者而变)
-P :保留绝对路径
-N :比后面接的日期(yyyy/mm/dd)还要新的才会被打包进新建的文件中!
一、压缩,解压缩,查询
压缩:tar -zcvf filename.tar.gz 要被压缩的文件或目录名称
查询:tar -ztvf filename.tar.gz
解压缩:tar -zxvf filename.targz -C 想要压缩的目录
二、向归档文件中添加文件
向已经存在的归档文件中添加文件,追加选项-r
tar-rvf original.tar new filename
三、拼接两个压缩文件
用-A选项合并多个tar文件
tar -Af file1.tar file2.tar
四、在归档文件中排除部分文件
用--exclude[PATTETN]排除匹配通配符的文件
如排除所有.txt文件
tar -cf xiao.tar* --exclude “*.txt“
标签:Linux系统,tar命令,
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
微软延长Office 2016服务支持时间:直到2023年10月
2022-05-18 16:45:25
![](https://img.aspxhome.com/file/2023/4/a305137_0s.jpg)
Win11系统分区如何加密?Win11系统分区加密的方法
2022-11-06 02:17:58
![](https://img.aspxhome.com/file/2023/27/a236378_0s.jpg)
win10版本1909hosts文件本地路径位置
2023-12-21 02:08:41
![](https://img.aspxhome.com/file/2023/5/a315712_0s.jpg)
AirPods 3 实物图曝光,这个非入耳式设计爱了
2022-07-20 17:46:05
![](https://img.aspxhome.com/file/2023/5/a208005_0s.png)
PowerPoint2007如何将列表文字变图形
2022-03-27 12:03:00
![](https://img.aspxhome.com/file/2023/10/a344677_0s.png)
excel反正弦函数的用法
2022-02-06 08:54:33
iOS8全新功能:更便捷实惠的AppStore
2023-05-13 17:35:59
Win7电脑无法连接到Internet怎么办?
2022-05-20 16:12:26
![](https://img.aspxhome.com/file/2023/27/a231526_0s.jpg)
Win10如何进行长截图?Win10进行长截图的方法
2023-11-21 13:35:30
![](https://img.aspxhome.com/file/2023/25/a217683_0s.jpg)
Excel 2013中用鼠标加键盘实现移动列的方法
2023-03-07 09:36:25
![](/images/sg_trans.gif)
word文档怎么打出目录上的点
2022-03-07 20:28:21
![](https://img.aspxhome.com/file/2023/7/31777_0s.png)
利用PPT制作“纸缝”效果,提升你PPT的品质!
2022-10-20 00:09:34
![](https://img.aspxhome.com/file/2023/10/a351891_0s.jpg)
漫游配置文件和本地配置文件有啥区别? Win11快速禁用漫游配置文件的技巧
2022-04-24 04:24:53
![](https://img.aspxhome.com/file/2023/28/a239078_0s.jpg)
wps表格设置仅套用表格样式的方法有哪些?
2023-03-23 20:16:23
PPT怎么让让圆球做圆周运动? ppt动画效果的制作方法
2022-05-30 03:08:10
![](https://img.aspxhome.com/file/2023/10/a349591_0s.png )
Win10电脑开机一直响怎么办?Win10电脑开机一直响的解决方法
2023-10-17 20:41:01
![](https://img.aspxhome.com/file/2023/8/52038_0s.jpg)
如何在smoothdraw修改画板尺寸?smoothdraw修改画板尺寸的方法
2022-03-19 22:14:39
![](https://img.aspxhome.com/file/2023/7/a329697_0s.jpg)
Mac上好用的剪切板增强管理工具推荐
2023-01-15 20:43:59
![](https://img.aspxhome.com/file/2023/0/a208390_0s.jpeg)
excel表格内进行打勾的方法
2022-09-11 07:58:00
Win10右下角的日历打不开怎么解决?
2022-09-01 05:26:09
![](https://img.aspxhome.com/file/2023/1/a282980_0s.png)