So I need to compress a directory with max compression.
How can I do it with
xz? I mean I will need
tar too because I can't compress a directory with only
xz. Is there a oneliner to produce e.g.
With a recent GNU
tar's lowercase j switch uses bzip, uppercase J switch uses xz.
This is now maximal.
is even better than
You might try different options, for me -4e works better
I tested by running:
So, it seems that option -4e works a little bit better than -9e.
This is not an exact answer to your question but you could use one command instead of two:
adds all files from directory "dir1" to archive archive.7z using "ultras ettings"
other formats supported are: zip, gzip, bzip2 or tar. for this just replace
NOTE: don't use this command to backup your system files except personal files because the 7z format doesn't store filesystem permissions.
If you have 16 GiB of RAM (and nothing else running), you can try:
This will need 1.5 GiB for decompression, and about 11x that for compression. Adjust accordingly for lesser amounts of memory.
This will only help if the data is actually that big, and in any case it won't help THAT much, but still...
If you're compressing binaries, add --x86 as the first xz option. If you're playing with "multimedia" files (uncompressed audio or bitmaps), you can try with --delta=dist=2 (experiment with value, good values to try are 1..4).
If you're feeling very adventurous, you can try playing with more LZMA options, like
(these are the default settings, you can try values between 0 and 4, and lc+lp must not exceed 4)
In order to see how the default presets map to these values, you can check the source file src/liblzma/lzma/lzma_encoder_presets.c. Nothing of much interest there though (-e sets the nice length to 273 and also adjusts the depth).