Create a tar.xz in one command

前端 未结 5 1935
逝去的感伤
逝去的感伤 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条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-29 19:15

    Try this: tar -cf file.tar file-to-compress ; xz -z file.tar

    Note:

    1. tar.gz and tar.xz are not the same; xz provides better compression.
    2. Don't use pipe | because this runs commands simultaneously. Using ; or & executes commands one after another.

提交回复
热议问题