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

猜你喜欢

转载自www.cnblogs.com/liubi/p/8993878.html
今日推荐