this post was submitted on 06 Jun 2024
931 points (99.1% liked)
linuxmemes
20880 readers
3 users here now
I use Arch btw
Sister communities:
- LemmyMemes: Memes
- LemmyShitpost: Anything and everything goes.
- RISA: Star Trek memes and shitposts
Community rules
- Follow the site-wide rules and code of conduct
- Be civil
- Post Linux-related content
- No recent reposts
Please report posts and comments that break these rules!
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
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?I download and then tar. Curl pipes are scary
They really, really aren’t. Let’s take a look at this command together:
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?
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.
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
It's not scary from the flags, but rather what is inside the tar/zip.
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