tar解压如何不带的以前目录

 

可以不带上级目录打包。在目录下用*号。

tar cvf   zhiban.tar   /root/zhiban
换成:
cd /root/zhiban
tar cvf   zhiban.tar   *

[root@localhost etc]# cd /etc/

[root@localhost etc]# tar -zcf passwd.tar.gz passwd gshadow

[root@localhost etc]# tar -xf passwd.tar.gz -C /mnt

[root@localhost etc]# ls /mnt/
gshadow passwd

 

posted @ 2018-05-05 10:24  夏天的麦田  阅读(1200)  评论(0编辑  收藏  举报