How can I decompress an archive file having .zst or tar.zst?

187,357

Solution 1

The extention .zst means that the archive is compressed by zstd.

The tar command has an option -I (--use-compress-program) to specify a command for compression/decompression.

You can use it as follows.

$ tar --use-compress-program=unzstd -xvf archive.tar.zst

Solution 2

Decompress it in Terminal.

unzstd yourfilename.zst

I know there aren't many resources available but I found this here: http://manpages.org/zstd

Solution 3

If you have a standard cmake + gcc build stack:

git clone https://github.com/facebook/zstd.git
cd zstd/build/cmake
cmake .
make
./programs/zstd -d /path/to/file.zst

Solution 4

On macOS Mojave 10.14.3, I was unable to specify the compression algorithm using the -I flag. Doing it this way worked for me;

Install zstd using brew if you don't already have it installed.

  1. Decompress from .zst: unzstd filename.tar.zst or zstd -d filename.tar.zst. filename.tar will be created.
  2. List compressed archive: tar tf filename.tar.
  3. Extract the compressed archive: tar xf filename.tar.

Hope this helps.

Solution 5

I found some of these files in the Anaconda downloads. After I installed Anaconda, I was downloading additional packages. The downloaded packages in my Anaconda download directory were zip files (without the .zip extension), but they had these .tar.zst files inside them. That led me to stackoverflow to figure out what they were, which led me to this question. If you're in the same boat, then Anaconda also supplies the answer.

It turns out that the zstd and unzstd executables are also installed by the Anaconda installer, so they should be available at the command line if you're in your Anaconda environment.

Share:
187,357
Quarkonia
Author by

Quarkonia

Updated on November 08, 2021

Comments

  • Quarkonia
    Quarkonia about 1 year

    I do not know how I can decompress a file having .zst or tar.zst extension . The full filename :- file.pkg.tar.zst or file.xz.tar.zst

  • Nike
    Nike about 5 years
    tar (child): zstd: Cannot exec: No such file or directory
  • hBy2Py
    hBy2Py almost 5 years
    @user1271772 Might not be installed. For Debian, sudo apt-get install zstd. yum or whatever for other distros.
  • Nike
    Nike almost 5 years
    Is there a way without installing anything extra? I don't have sudo permission on the server. I would rather not have to scp the file to a different machine, uncompress, then transfer back.
  • Suici Doga
    Suici Doga over 4 years
    @user1271772 you could build it from source
  • Nike
    Nike over 4 years
    @SuiciDoga: Good idea. Though it's unfortunate we can't decompress these files more "natively".
  • Suici Doga
    Suici Doga over 4 years
    @user1271772 if you want to uncompress natively you could install the package
  • Nike
    Nike over 4 years
    @SuiciDoga: I just explained that I don't have sudo permission. So as you say, the only way is to install from source, but that is not "native". It would be nice if the Linux distribution had this program just like it comes with the programs "grep" and "vi"
  • Suici Doga
    Suici Doga over 4 years
    @user1271772 ubuntu is going to use zstd by default in the future
  • Devy
    Devy over 3 years
    The -I or --use-compress-program argument only works if I use the equal sign format on the Mac. So, tar -I=/usr/local/sbin/zstd -xvf archive.tar.zst works but the one given above doesn't. see detail on gnu.org/software/tar/manual/html_node/gzip.html
  • Peter M
    Peter M over 3 years
    no need to use the python wrapper for zstandard here, and this python script starts with an elif so will not even run...
  • Jonathan Lam
    Jonathan Lam over 3 years
    How will you decompress on windows?
  • Peter M
    Peter M over 3 years
    Fair enough. Still, this is not a functioning python script (starts with elif poorly described variables, leaves out some sort of file-path selection mechansim?, …). On top of that, from what I can tell, this would just decompress to a .tar archive which is a solution to only half of the poster's problem.
  • Jonathan Lam
    Jonathan Lam over 3 years
    That's why there is ... The code is not complete. OP question's title was How to decompress. I answered that.
  • Amit Naidu
    Amit Naidu over 2 years
    This tar command also works fine in Git-Bash, if you are on Windows.
  • Max F over 2 years
    as someone without root permissions, this answer was amazingly helpful and complete. Cannot thank you enough
  • Ger
    Ger over 2 years
    If you want to extract you have to select unzstd. The following worked for me: tar --use-compress-program=unzstd -xvf archive.tar.zst
  • rubo77
    rubo77 over 2 years
    you have to install the package zstd for the unzstd command. note, that it has problems with a colon in the package name, so rename those packages beforehand
  • Professor Tom
    Professor Tom over 2 years
    Mac 10? 10.0 was a long, long time ago, but Zstandard is a recent algorithm.
  • DKMDebugin over 2 years
    I am not clear on what you meant but zstd is a utility that implements the zstandard compression algorithm.
  • Professor Tom
    Professor Tom over 2 years
    In your post, you said Mac 10. I think you meant to say something along the lines of macOS 10.15, Catalina or something to that effect. OS X 10.0 Cheetah was released in 2001: en.wikipedia.org/wiki/MacOS#Mac_OS_X_10.0_Cheetah
  • DKMDebugin about 2 years
    Thanks. Updated it.
  • Ed Randall
    Ed Randall about 2 years
    This is useful, saved me further trouble adding a package to git-for-windows (MSYS2) avoiding all manner of hoops. And it works on Windows. Used python -m pip install zstandard to install the module.
  • Jonathan Lam
    Jonathan Lam about 2 years
    Thanks @EdRandall. I don't know why people would downvote it tho :)
  • OhhhThatVarun
    OhhhThatVarun almost 2 years
    It will decompress it to tar. Then I used 7zip to decompress it to normal folder.
  • Admin
    Admin over 1 year
    @rubo77 For me, it works with a colon, must be updated or something. But what I am guessing is that your shell is not working and maybe quote it with '' or "", or you can just escape it with \.
  • Jeff Muizelaar about 1 year
    If you're tar has builtin zstd support you can just use tar axvf archive.tar.zst which will autodetect the compression format.
  • Aaron Franke
    Aaron Franke about 1 year
    How do I decompress this file type on Windows?
  • user1043144
    user1043144 about 1 year
    this was useful to me. especially the streaming part