Can be packaged without parent directory. Use * in the directory. Replace tar cvf zhiban.tar /root/zhiban with : 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