Jorge Castro Jorge Castro Better Question to ask than how to do this with tar: Use unar or 7z and never worry about choosing the right program for your type of archive again. This is the only feasible solution looking forward with more and more archive types coming. Unless you care about the technical details Add a comment. Active Oldest Votes. Improve this answer. Damian Yerrick 13 13 bronze badges.
It's a feature of GNU tar. I don't know about competing implementations, but GNU tar should be the most relevant to ubuntu. This is not an answer, it is a 'you don't care about the answer, even though you asked' response. Spare a thought for people who are not on 'latest' — Sean Houlihane. What version of tar no longer requires the specific flag?
Show 8 more comments. Try tar -xJf file. Jorge Castro I wonder how many flags will we have in Knowing tar switches is already a black-belt in Linux-fu. Shiki: That's probably why it doesn't make you specify the compression format flag anymore. This should totally be the accepted answer since it answers the question for any version of tar supporting. In the year flags become Turing complete Show 3 more comments.
Mathias Bynens Mathias Bynens 8 8 silver badges 9 9 bronze badges. That should be constructable with a pipe. At least on my Ubuntu machine, unxz is not equivalent to xz -dc , but to xz -d. The source file is never removed if the output is written to standard output. This has only limited use since when standard error is a terminal, using --verbose will display an automatically updating progress indicator. The memory usage of xz varies from a few hundred kilobytes to several gigabytes depending on the compression settings.
The settings used when compressing a file affect also the memory usage of the decompressor. Still, the worst-case memory usage of the decompressor is several gigabytes. To prevent uncomfortable surprises caused by huge memory usage, xz has a built-in memory usage limiter. While operating systems provide ways to limit the memory usage of processes, relying on it wasn't deemed to be flexible enough.
If the compression settings exceed the limit , xz will adjust the settings downwards so that the limit is no longer exceeded and display a notice that automatic adjustment was done.
In those cases, an error is displayed and xz will exit with exit status 1. Using an integer suffix like MiB can be useful. That way the limit is automatically bigger on systems with more memory. This is currently equivalent to setting the limit to max no memory usage limit.
Once multithreading support has been implemented, there may be a difference between 0 and max for the multithreaded case, so it is recommended to use 0 instead of max until the details have been decided. See also the section Memory usage. This also affects the --list mode. If the operation is not possible without exceeding the limit , xz will display an error and decompressing the file will fail.
The default is to adjust the settings downwards so that the memory usage limit is not exceeded. Setting threads to a special value 0 makes xz use as many threads as there are CPU cores on the system. The actual number of threads can be less than threads if the input file is not big enough for threading with the given settings or if using more threads would exceed the memory usage limit.
Currently the only threading method is to split the input into blocks and compress them independently from each other. Threaded decompression hasn't been implemented yet.
It will only work on files that contain multiple blocks with size information in block headers. Custom compressor filter chains A custom filter chain allows specifying the compression settings in detail instead of relying on the settings associated to the presets. When a custom filter chain is specified, preset options If a preset option is specified after one or more custom filter chain options, the new preset takes effect and the custom filter chain options specified earlier are forgotten.
A filter chain is comparable to piping on the command line. When compressing, the uncompressed input goes to the first filter, whose output goes to the next filter if any. The output of the last filter gets written to the compressed file. The maximum number of filters in the chain is four, but typically a filter chain has only one or two filters.
Many filters have limitations on where they can be in the filter chain: some filters can work only as the last filter in the chain, some only as a non-last filter, and some work in any position in the chain. Depending on the filter, this limitation is either inherent to the filter design or exists to prevent security issues. A custom filter chain is specified by using one or more filter options in the order they are wanted in the filter chain.
That is, the order of filter options is significant! Filters take filter-specific options as a comma-separated list. Extra commas in options are ignored.
Every option has a default value, so you need to specify only those you want to change. To see the whole filter chain and options , use xz -vv that is, use --verbose twice. This works also for viewing the filter chain options used by presets. These filters can be used only as the last filter in the chain. LZMA1 is a legacy filter, which is supported almost solely due to the legacy.
Preset consist of an integer, which may be followed by single-letter preset modifiers. The integer can be from 0 to 9 , matching the command line options The only supported modifier is currently e , which matches --extreme. The algorithm tries to find repeating byte sequences matches in the uncompressed data, and replace them with references to the data currently in the dictionary. The bigger the dictionary, the higher is the chance to find a match. Thus, increasing dictionary size usually improves compression ratio, but a dictionary bigger than the uncompressed file is waste of memory.
Typical dictionary size is from 64 KiB to 64 MiB. The minimum is 4 KiB. The maximum for compression is currently 1. The same or bigger dictionary size is required for decompressing that was used when compressing, thus the memory usage of the decoder is determined by the dictionary size used when compressing. Other sizes will get rounded up when stored in the. The minimum is 0 and the maximum is 4; the default is 3. In addition, the sum of lc and lp must not exceed 4.
All bytes that cannot be encoded as matches are encoded as literals. That is, literals are simply 8-bit bytes that are encoded one at a time. The literal coding makes an assumption that the highest lc bits of the previous uncompressed byte correlate with the next byte. When lc is at least 3, the literal coding can take advantage of this property in the uncompressed data. The default value 3 is usually good. Sometimes it helps a little, and sometimes it makes compression worse.
If it makes it worse, test e. The minimum is 0 and the maximum is 4; the default is 0. Lp affects what kind of alignment in the uncompressed data is assumed when encoding literals. See pb below for more information about alignment. The minimum is 0 and the maximum is 4; the default is 2.
Pb affects what kind of alignment in the uncompressed data is assumed in general. When the aligment is known, setting pb accordingly may reduce the file size a little.
Usually Hash Chain match finders are faster than Binary Tree match finders. The default depends on the preset : 0 uses hc3 , use hc4 , and the rest use bt4.
The following match finders are supported. The memory usage formulas below are rough approximations, which are closest to the reality when dict is a power of two. Supported modes are fast and normal. The default is fast for presets and normal for presets Usually fast is used with Hash Chain match finders and normal with Binary Tree match finders. This is also what the presets do. Once a match of at least nice bytes is found, the algorithm stops looking for possibly better matches.
Nice can be bytes. Higher values tend to give better compression ratio at the expense of speed. The default depends on the preset. The default is the special value of 0, which makes the compressor determine a reasonable depth from mf and nice.
Reasonable depth for Hash Chains is and for Binary Trees. Using very high values for depth can make the encoder extremely slow with some files. Avoid setting the depth over unless you are prepared to interrupt the compression in case it is taking far too long. LZMA1 needs also lc , lp , and pb.
These filters can be used only as a non-last filter in the filter chain. A BCJ filter converts relative addresses in the machine code to their absolute counterparts. The BCJ filters are always reversible, so using a BCJ filter for wrong type of data doesn't cause any data loss, although it may make the compression ratio slightly worse. It is fine to apply a BCJ filter on a whole executable; there's no need to apply it only on the executable section.
Applying a BCJ filter on an archive that contains both executable and non-executable files may or may not give good results, so it generally isn't good to blindly apply a BCJ filter when compressing binary packages for distribution.
These BCJ filters are very fast and use insignificant amount of memory. If a BCJ filter improves compression ratio of a file, it can improve decompression speed at the same time. This is because, on the same hardware, the decompression speed of LZMA2 is roughly a fixed number of bytes of compressed data per second. These BCJ filters will still do the address conversion, which will make the compression worse with these files. This is because the BCJ filter doesn't detect the boundaries of the executable files, and doesn't reset the address conversion counter for each executable.
Both of the above problems will be fixed in the future in a new filter. The old BCJ filters will still be useful in embedded systems, because the decoder of the new filter will be bigger and use more memory. Looking to open a XZ file? Download WinZip to open your XZ file now. If your compressed file was downloaded from the internet, it may be saved in the Downloads folder in your Documents or user directory.
0コメント