[billing_dx@bmcs1 temp]$ ls /tmp/temp/temp a b c [billing_dx@bmcs1 temp]$ tar -cvf a.tar /tmp/temp/temp tar: Removing leading `/‘ from member names #默认会去掉“/” /tmp/temp/temp/ /tmp/temp/temp/c /tmp/temp/temp/b /tmp/temp/temp/a [billing_dx@bmcs1 temp]$ tar -tvf a.tar #去掉根目录“/”之后,依旧保留路径 drwxr-xr-x billing_dx/BILLING 0 2014-03-06 14:44 tmp/temp/temp/ -rw-r--r-- billing_dx/BILLING 0 2014-03-06 14:41 tmp/temp/temp/c -rw-r--r-- billing_dx/BILLING 0 2014-03-06 14:41 tmp/temp/temp/b -rw-r--r-- billing_dx/BILLING 0 2014-03-06 14:41 tmp/temp/temp/a
[billing_dx@bmcs1 temp]$ tar -cvf a.tar -C /tmp/temp/ temp/ temp/ temp/c temp/b temp/a [billing_dx@bmcs1 temp]$ tar -tvf a.tar drwxr-xr-x billing_dx/BILLING 0 2014-03-06 14:44 temp/ -rw-r--r-- billing_dx/BILLING 0 2014-03-06 14:41 temp/c -rw-r--r-- billing_dx/BILLING 0 2014-03-06 14:41 temp/b -rw-r--r-- billing_dx/BILLING 0 2014-03-06 14:41 temp/a
原文:http://blog.csdn.net/yang15225094594/article/details/20628189