tar归档报错tar: Removing leading `/‘ from member names
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了tar归档报错tar: Removing leading `/‘ from member names相关的知识,希望对你有一定的参考价值。
今天用tar命令归档文件的时候一直提示“tar: Removing leading `/' from member names”[[email protected] tmp]# tar -cvf test.tar /tmp/*
tar: Removing leading `/' from member names
/tmp/123.tar
/tmp/1.txt
/tmp/2.tar
/tmp/P
tar: /tmp/test.tar: file is the archive; not dumped
苦于不知道怎么解决,无奈之下只能查看一下man手册,本人比较懒,不喜欢看man手册,这不是个好习惯
然后发现里面有个-P选项能解决这个问题
-P, --absolute-names
don’t strip leading ‘/’s from file names
然后就果断测试一下
[[email protected] tmp]# tar -cvfP test1.tar /tmp/*
test1.tar
tar: Removing leading `/' from member names
/tmp/123.tar
/tmp/1.txt
/tmp/2.tar
tar: /tmp/P: file is the archive; not dumped
/tmp/test1.tar
/tmp/test.tar
#发现有报的新的错误,为什么呢?原来是tar命令-f选项后面必须接文件,不能接其他的。立马把f和P调换一下位置
[[email protected] tmp]# tar -cvPf test1.tar /tmp/*
/tmp/123.tar
/tmp/1.txt
/tmp/2.tar
/tmp/P
/tmp/test.tar
发现成功,结束
以上是关于tar归档报错tar: Removing leading `/‘ from member names的主要内容,如果未能解决你的问题,请参考以下文章