在命令 tar -zxvf <filename> 中,-zxvf 是什么意思?

47

我在许多网站上见过像这样的命令,"-zxvf"或类似命令代表什么意思?

tar -zxvf <filename>
 tar xvf <filename>

12
这是一个关于tar命令的信息或手册页面。 - user1508519
2
阅读软件的描述,例如 tar --helpman tar。确实如此。这也与编程无关,让我们快速结束它。 - DevSolar
1
这个问题更适合在 http://superuser.com/ 或者 http://serverfault.com/ 提问。请尽量只提出与编程/软件开发以及编程工具相关的问题。 - lucian.pantelimon
1
请参考Linux man手册获取所有信息。 - Sreedhar GS
2个回答

145
  • z表示(u)解压缩。
  • x表示从档案中提取文件。
  • v表示详细地打印文件名。
  • f表示后面的参数是文件名。

更多详细信息,请参见tar手册页面


@rakeb.mazharul 请查看man页面 - Potatoswatter

14

不必深入了解所有选项的描述,您可以在info tar命令下跳转到3.4.3短选项交叉引用

x表示--extractv表示--verbosef表示--filez表示--gzip。 您可以将单个字母参数组合在一起,f需要一个参数,即文件名。 有一些需要注意的事情:

Short options' letters may be clumped together, but you are not required to do this (as compared to old options; see below). When short options are clumped as a set, use one (single) dash for them all, e.g., ''tar' -cvf'. Only the last option in such a set is allowed to have an argument(1).


This old way of writing 'tar' options can surprise even experienced users. For example, the two commands:

 tar cfz archive.tar.gz file
 tar -cfz archive.tar.gz file

are quite different. The first example uses 'archive.tar.gz' as the value for option 'f' and recognizes the option 'z'. The second example, however, uses 'z' as the value for option 'f' -- probably not what was intended.


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接