在一个命令中创建tar.xz [英] Create a tar.xz in one command

查看:165
本文介绍了在一个命令中创建tar.xz的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用一个命令创建一个.tar.xz压缩档案.具体的语法是什么?

I am trying to create a .tar.xz compressed archive in one command. What is the specific syntax for that?

我尝试过tar cf - file | xz file.tar.xz,但这不起作用.

I have tried tar cf - file | xz file.tar.xz, but that does not work.

推荐答案

xz使用-J压缩选项.并记得 man tar :)

Use the -J compression option for xz. And remember to man tar :)

tar cfJ <archive.tar.xz> <files>

编辑2015-08-10:

Edit 2015-08-10:

如果您要将参数传递给带有破折号的tar (例如:tar -cf而不是tar cf),则然后-f选项必须排在最后,因为它指定了文件名(感谢 @ABB 指出!).在这种情况下,命令如下所示:

If you're passing the arguments to tar with dashes (ex: tar -cf as opposed to tar cf), then the -f option must come last, since it specifies the filename (thanks to @A-B-B for pointing that out!). In that case, the command looks like:

tar -cJf <archive.tar.xz> <files>

这篇关于在一个命令中创建tar.xz的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆