Skip to content

Instantly share code, notes, and snippets.

@fabiomontefuscolo
Last active March 21, 2024 22:01
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save fabiomontefuscolo/747c33dc76329b28c9db21bb10c40015 to your computer and use it in GitHub Desktop.
Save fabiomontefuscolo/747c33dc76329b28c9db21bb10c40015 to your computer and use it in GitHub Desktop.
XZ and tricks

XZ

  1. Compress a file (filename.sql will be replaced by filename.sql.xz)
xz filename.sql
  1. Uncompress file (filename.sql.xz will be replaced by filename.sql)
xz -d filename.sql.xz
  1. Compress folder
tar -cJvf folder.tar.xz folder/
  1. Uncompress folder
tar -xJvf folder.tar.xz folder/
  1. Compress file from stdin
mysqldump mydatabase | xz > mydump.sql.xz
  1. Uncompress and send content to stdout
xzcat mydump.sql.xz | mysql mydatabase
  1. Uncompress tar folder from stdin sent from ncat
ncat -l -p 7000 | tar -xJvf -
  1. Compress folder to stdout and send to ncat
tar -cJvz - folder/ | ncat targetserver.com 7000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment