可以不带上级目录打包。在目录下用*号。 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