返回> 网站首页 

[转载]用tar打包时忽略文件目录

yoours2015-06-29 10:46:13 阅读 1586

简介一边听听音乐,一边写写文章。

一、打包忽略指定目录
-C 指定忽略的目录

  -C, --directory DIR
              change to directory DIR

打包
[root@hongdi lhd]# tar -cvf c.tar -C /home/lhd a.txt
a.txt

解压
[root@hongdi lhd]# tar -tvf c.tar
-rw-rw-r-- lhd/lhd       10240 2009-02-03 13:12 a.txt

打包忽略多个目录或文件
tar --exclude home/update/redhat/*   --exclude lib   --exclude usr/share 

二、回退上次进入的目录
     cd -

微信小程序扫码登陆

文章评论

1586人参与,0条评论