Talk to me when you ffmpeg by heart π
post
eXtract Ze Vucking File
tar is usually smart enough to figure that .tar.gz is a compressed archive, so tar xvf suffices.
Moreover, .tar.xz archives are much more common nowadays, and the flag to tell tar to use xz decompression is J. Yes, uppercase J I shit you not, because all other letters of alphabet were already taken. The next commandline option added to tar is going to be a Unicode emoji symbol.
The flag to extract .bz2 files is 'j'. Not confusing at all.
BurrowsβWheeler algorithm or block-compression algorithm, the bzip2 file compression program was developed by Julian Seward.
Ah yes, totally makes sense.
XZ Utils started as a Unix port of Igor Pavlov's LZMA (LempelβZivβMarkov) algorithm, by Lasse Collin, and then by the Tukaani Project.
So apparently the uppercase J stands for "that guy who made a better compression algorithm than Julian".
i always forgot about -J so i got used to writing tar --xz -cvf archive.tar.xz file1 file2β¦ instead. it's a bit more explicit and i'll never have to hunt for the same flag in the man page again.
I was going to use this opportunity to shill for tldr by linking directly to their page on tar.
But I just realized tar's reputation is so bad, they use it as the example on tldr's homepage. π

Homepage? That should totally be a Linux command alongside --help, and man.
It is; I use it all the time!
https://github.com/tldr-pages/tldr/wiki/Clients#console-clients
I was gonna say, my knowledge of tar and ffmpeg (and god knows how many other progs) is basically limited to what's on tldr.
Again this old myth that using tar is possible without looking up commands every time. It's been debunked many times
eXtract Ze File
xzvf or nothing
but how am i supposed to remember that?
eXtract Ze Vucking File?
e[x]tract; g[z]ip; [v]erbose; [f]ile
Reordered, and we can have [v]erbosely e[x]tract g[z]ip [f]ile, or tar vxzf [file]
I find it more difficult to remember other options. Might stick better if pronouncing the g in gzip similarly as GNU insists GNU be pronounced, with a hard gβnever really tried it, but sounds a little funny. Actually, I think I first remembered it as g sounding like the, making for extract the zip file, but with a soft g; I felt the former put too much emphasis on a letter not used as an option.
Honestly at this point, I remember zxvf and xvfj purely through muscle memory.
I can do it if what I want to do is to extract a .tar.gz or .tar.bz2. Anything else is a myth
Pretty sure tar is some quantum artifact that changes it's parameters every time you need to use it.
I saw tar -xvf 13 years ago and have been using it ever since.
I just use tar xf (extract file). Not sure, if that would've already worked 13 years ago...
Use "tvf" (or tvzf or tvJf) first to make sure the files are nested nicely and not about to splooge all over your home directory.
same. One of those commands I only ever see with a specific set of flags that makes me wonder why or how flags are even useful for most users
Same. And if it's compressed you just add the appropriate shorthand in the letter soup somewhere in the middle:
z for gzip
j for bzip (for some reason)
..and I'm sure the other common algorithms have associated letters in tar. If not, pipe it
Tar (some versions at least?) is actually smart enough to detect which format to use based on file extension of the output, so you don't need to remember which flag corresponds to which compressor. Examples:
tar -caf archive.tar.xz [files]
tar -caf archive.tar.bz2 [files]
# extract
tar -xf archive.tar.xz
tar -xf archive.tar.bz2
So you really only need to remember that c means create, x means extract
I once had a job where I used tar multiple times a day for years. I don't think I could forget how to use it if I wanted to, which I don't because I still use it.
It's pretty simple
tar
e[x]tract
[z]is
[f]ile
[v]erbosely
archive.tar.gz
--directory=archivedir
For creation it's pretty much the same but you need to specify [c]reate, e.g. tar czvf archive.tar.gz filestoarchive/ and for lis[t]ing it's - tar tf archive.tar.gz
It's easy, you just have to remember the development was from Transylvania.
EXtract Ze Vamn Files
Why is everyone always going in about tar? I never saw the issue with it, its not more or less complicated than other commands that take command line flags...
For example: sudo netstat -peanut, where -peanut actually expands to -p -e -a -n -u -t. I don't have any idea anymore what each letter stands for while I do recall that tar -cjf file.tar * is -c create, -j bzip2 compression and -f filename
Hah, I was taught to do netstat -tulpn. "Tulpen" is German for "tulips".
Also, these days ss has generally replaced netstat (cause it's built into the kernel), so now I get to tell our trainees to run ss -tulpn.
Every time, they think I'm bullshitting them, which is hilarious.
zxf and zcf for me, I know what they do but not what it means. It's been like 30 years at this point
This is output on my setup (I frequently forget that I did this):
$ tarhelp
helper definitions for tarcomp, untar, and tarls / tarlist:
- tar[comp] -czvf archive.tar.gz file1 file2 dir1 file3
- [un]tar -xvf archive.tar.gz
- tar[ls|list] -tvf archive.tar.gz
A clever helper, I think. If I remember to use it.
I still remember moment when I accidentally swapped tar's arguments and it just overwrited my 20 Gib directory with empty tarball. (I had backups luckily.)
Same but with math: https://en.wikipedia.org/wiki/The_Feeling_of_Power
Read here (PDF): https://archive.org/download/TheFeelingOfPower/The%20Feeling%20of%20Power.pdf
more ~/.zsh_history | grep tar
highlight
copy
paste
move cursor to change file
am i doing it right
tar is chill as fuck. Try messing with zip and unzip. Fuck zip.
Tar used to be more complicated, some of the flags are not necessary anymore but I still create .tbz2 with cvjf and extract with xvzf.

all 88 comments