Create a tar.xz in one command

前端 未结 5 1928
逝去的感伤
逝去的感伤 2021-01-29 18:32

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

I have tried tar cf - file | xz file.tar.xz

5条回答
  •  孤独总比滥情好
    2021-01-29 18:53

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

    tar cfJ  
    

    Edit 2015-08-10:

    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  
    

提交回复
热议问题