What the fuck is that file extension?
.tar.xz
☠️
.fitgirlrepack
Im a pirate, I am rar like, roawr, lol
This guy tar balls
What’s wrong with .7z?
Nothing, but I’ve read people who act as if tar files are some sort of alien artifact ready to rip their faces off.
Compatibility aside, I’d say that
.tar.pxz
aka.tpxz
is probably my vote.LZMA is probably what I’d want to use.
xz
and7zip
use that. It’s a bit slow to compress, but it has good compression ratios, and it’s faster to decompress than bzip2.pixz
permits for parallel LZMA compression/decompression. On present-day processors with a lot of cores, that’s desirable.It also can use .tar as its container format, which is desirable; that’s everywhere.
The major drawback to .tar is that it doesn’t support indexed access, so extracting a single file isn’t fast, but .tar.pxz does.
When I’m feeling cool and downloading a
*.tar*
file, I’llwget
to stdout, and tar from stdin. Archive gets extracted on the fly.I have (successfully!) written an
.iso
to CD this way, too (pipe wget to cdrecord). Fun stuff.Something like
wget avc.com | tar xvf
?Almost, I think.
wget -O - http://example.com/archive.tar | tar -xvf -
I usually suppress output of either wget (-q) or of tar (no v flag), otherwise I think the output gets mangled and looks funny (you see both download progress and files being extracted).
Didnt think this would ever work
TAr stands for Tape Archive. Tapes store data sequentially. Downloads are done sequentially.
It’s really just like a far away tape drive.
This is what we call UNIX-way
deleted by creator
If you download and extract the tarball as two separate steps instead of piping
curl
directly intotar xz
(for gzip) /tar xj
(for bz2) /tar xJ
(for xz), are you even a Linux user?the problem is if the connection gets interrupted your progress is gone. you download to a file first and it gets interrupted, you just resume the download later
I download and then tar. Curl pipes are scary
They really, really aren’t. Let’s take a look at this command together:
curl -L [some url goes here] | tar -xz
Sorry the formatting’s a bit messy, Lemmy’s not having a good day today
This command will start to extract the tar file while it is being downloaded, saving both time (since you don’t have to wait for the entire file to finish downloading before you start the extraction) and disk space (since you don’t have to store the .tar file on disk, even temporarily).
Let’s break down what these scary-looking command line flags do. They aren’t so scary once you get used to them, though. We’re not scared of the command line. What are we, Windows users?
- curl -L – tells curl to follow 3XX redirects (which it does not do by default – if the URL you paste into cURL is a URL that redirects (GitHub release links famously do), and you don’t specify -L, it’ll spit out the HTML of the redirect page, which browsers never normally show)
- tar -x – eXtract the tar file (other tar “command” flags, of which you must specify exactly one, include -c for Creating a tar file, and -t for Testing a tar file (i.e. listing all of the filenames in it and making sure their checksums are okay))
- tar -z – tells tar that its input is gzip compressed (the default is not compressed at all, which with tar is an option) – you can also use -j for bzip2 and -J for xz
- tar -f which you may be familiar with but which we don’t use here – -f tells tar which file you want it to read from (or write to, if you’re creating a file). tar -xf somefile.tar will extract from somefile.tar. If you don’t specify -f at all, as we do here, tar will default to reading the file from stdin (or writing a tar file to stdout if you told it to create). tar -xf somefile.tar (or tar -xzf somefile.tar.gz if your file is gzipped) is exactly equivalent to cat somefile.tar.gz | tar -xz (or tar -xz < somefile.tar – why use cat to do something your shell has built-in?)
- tar -v which you may be familiar with but which we don’t use here – tells tar to print each filename as it extracts the file. If you want to do this, you can, but I’d recommend telling curl to shut up so it doesn’t mess up the terminal trying to show download progress also: curl -L --silent [your URL] | tar -xvz (or -xzv, tar doesn’t care about the order)
You may have noticed also that in the first command I showed, I didn’t put a - in front of the arguments to tar. This is because the tar command is so old that it takes its arguments BSD style, and will interpret its first argument as a set of flags regardless of whether there’s a dash in front of them or not. tar -xz and tar xz are exactly equivalent. tar does not care.
It’s not scary from the flags, but rather what is inside the tar/zip.
Thanks for the explanation, I might use more pipes now. Is it correct, that tar will restore the files in the tarball in the current directory?
Yes. You can specify
tar -C somedir
if you want it to extract them somewhere else.As a rule of thumb, I always extract my tarballs in a newly created, empty directory, just in case whoever packed it didn’t put all its files in a subdir
That’s fine. I’m use to being unrepresented in the arj, lha, and uc2 crew
I’m the weird one in the room. I’ve been using 7z for the last 10-15 years and now
.tar.zst
, after finding out that ZStandard achieves higher compression than 7-Zip, even with 7-Zip in “best” mode, LZMA version 1, huge dictionary sizes and whatnot.zstd --ultra -M99000 -22 files.tar -o files.tar.zst
You can actually use Zstandard as your codec for 7z to get the benefits of better compression and a modern archive format! Downside is it’s not a default codec so when someone else tries to open it they may be confused by it not working.
That is an interesting implementation of security through obscurity…
How does one enable this on the standard 7Zip client?
On Windows, it’s easy! Unfortunately, on Linux, as far as I know, you currently have to use a non-standard client.
Cool, THANKS!! 😊 🙏
Oblig. XKCD:
tar -uhhhmmmfuckfuckfuck
tar eXtactZheVeckingFile
You don’t need the v, it just means verbose and lists the extracted files.
You don’t need the z, it auto detects the compression
Yeah, I just tell our Linux newbies
tar xf
, as in “extract file”, and that seems to stick perfectly well.That’s still kinda new. It didn’t always do that.
Per https://www.gnu.org/software/tar/, it’s been the case since 2004, so for about 19 and a half years…
Telling someone that they are Old with saying they are old…
Something something don’t cite the old magics something something I was there when it was written…
Right, but you have no way of telling what version of tar that bomb is running
You may not, but I need it. Data anxiety is real.
Me trying to decompress a .tar file
Joke’s on you, .tar isn’t compression
That’s not going to stop me from getting confused every time I try!
tar -xzf
(read with German accent:) extract the files
Ixtrekt ze feils
z
is for gzip archives only.tar xf
for eXtract the FileThat’s so good I wish I needed to memorize the command
German here and no shit - that is how I remember that since the first time someone made that comment
Same. Also German btw 😄
Not German but I remember the comment but not the right letters so I would have killed us all.
That’s yet another great joke that GNU ruined.
tar -h
Edit: wtf… It’s actually
tar -?
. I’m so disappointedboom
The Fish shell shows me just the past command with tar
So I don’t need to remember strange flags
I use zsh and love the fish autocomplete so I use this:
https://github.com/zsh-users/zsh-autosuggestions
Also have
fzf
forctrl + r
to fuzzy find previous commands.I believe it comes with oh-my-zsh, just has to be enabled in plugins and itjustworks™
without looking, what’s the flag to push over ssh with compression
scp
not compressed by default
man tar
you never said I can’t run a command before it.
i just use either zip or tar+gzip. personally, i avoid rar as it’s a proprietary format.
.tar.gz
, or.tgz
if I’m in a hurry…or shipping to MSDOS