tar命令中的

我用这个命令:tar zcvf chao.tar.gz /chao/*  打包文件的时候,在压缩包里把  /chao/这个路径也打包进去了。

1[root@yunwei-test chao]# ls /chao/ 201.txt 02.txt 03.txt 04.txt 05.txt 06.txt 07.txt 08.txt 09.txt 10.txt 3 4[root@yunwei-test chao]# tar zcvf /tar/chao.tar.gz /chao/* 5tar: Removing leading `/' from member names 6/chao/01.txt 7/chao/02.txt 8/chao/03.txt 9/chao/04.txt 10/chao/05.txt 11/chao/06.txt 12/chao/07.txt 13/chao/08.txt 14/chao/09.txt 15/chao/10.txt 16 17[root@yunwei-test chao]# ls /tar/ 18chao.tar.gz 19 20#解压 21[root@yunwei-test chao]# cd /tar/ 22[root@yunwei-test tar]# ls 23chao.tar.gz 24[root@yunwei-test tar]# tar xf chao.tar.gz 25[root@yunwei-test tar]# ls 26chao chao.tar.gz 27[root@yunwei-test tar]# cd chao/ 28[root@yunwei-test chao]# ls 2901.txt 02.txt 03.txt 04.txt 05.txt 06.txt 07.txt 08.txt 09.txt 10.txt

我想不要路径,我不想切换目录过去,而又只想打包指定目录下的文件。 使用 -C 参数。 

1##打包[root@yunwei-test chao]# tar zcvf /tar/chao.tar.gz -C /chao . 2./ 3./01.txt 4./02.txt 5./03.txt 6./04.txt 7./05.txt 8./06.txt 9./07.txt 10./08.txt 11./09.txt 12./10.txt 13 14[root@yunwei-test chao]# ls /tar/ 15chao.tar.gz 16[root@yunwei-test chao]# cd /tar/ 17[root@yunwei-test tar]# ls 18chao.tar.gz#解压 19[root@yunwei-test tar]# tar xvf chao.tar.gz 20./ 21./01.txt 22./02.txt 23./03.txt 24./04.txt 25./05.txt 26./06.txt 27./07.txt 28./08.txt 29./09.txt 30./10.txt 31[root@yunwei-test tar]# ls 3201.txt 02.txt 03.txt 04.txt 05.txt 06.txt 07.txt 08.txt 09.txt 10.txt chao.tar.gz

##在解压的时候 -C 是解压到指定目录中。

点赞
收藏

评论区

加载中...

相关推荐

MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1

文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s

Oracle 分组与拼接字符串同时使用

SELECTT.,ROWNUMIDFROM(SELECTT.EMPLID,T.NAME,T.BU,T.REALDEPART,T.FORMATDATE,SUM(T.S0)S0,MAX(UPDATETIME)CREATETIME,LISTAGG(TOCHAR(

MySQL部分从库上面因为大量的临时表tmp_table造成慢查询

背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_

皕杰报表之UUID

​在我们用皕杰报表工具设计填报报表时,如何在新增行里自动增加id呢?能新增整数排序id吗?目前可以在新增行里自动增加id,但只能用uuid函数增加UUID编码,不能新增整数排序id。uuid函数说明:获取一个UUID,可以在填报表中用来创建数据ID语法:uuid()或uuid(sep)参数说明:sep布尔值,生成的uuid中是否包含分隔符'',缺省为

手写Java HashMap源码

HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程22

2020年前端实用代码段,为你的工作保驾护航

有空的时候,自己总结了几个代码段,在开发中也经常使用,谢谢。1、使用解构获取json数据let jsonData  id: 1,status: "OK",data: 'a', 'b';let  id, status, data: number   jsonData;console.log(id, status, number )