Skip to content

Instantly share code, notes, and snippets.

@yanli0303
Created July 31, 2024 17:29
Show Gist options
  • Save yanli0303/d901f26574b40ef5f1b21baf9e98497c to your computer and use it in GitHub Desktop.
Save yanli0303/d901f26574b40ef5f1b21baf9e98497c to your computer and use it in GitHub Desktop.
Compress and decompress files with xz

Compress and decompress files with xz

See xz manual

# compress a directory
XZ_OPT='-9' tar -chvJf output-file.tar.xz -C /your/dir .

# The output archive of the above command doesn't contain the root directory.
# To compress a directory with its name in the output archive, use below command:
cd /your
XZ_OPT='-9' tar -chvJf output-file.tar.xz dir
# decompress to the current directory.
tar -xvJf tomcat.tar.xz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment