Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Nearly everything that packs or unpacks stuff. tar, gunzip, and else. I can never remember if they are going to unpack everything into a subdirectory or spill everything into my home, and conversely I never know if after zipping there's gonna be a directory inside or not. Luckily dtrx and atool do the thing you want most of the time.

From the time I was a teen I think I remember that mount was difficult to use, and mounting a CD image required passing some arcane options, though maybe I just didn't know how to use it (on the other hand I didn't know how to use Daemon Tools either, and it just worked).

I don't have a problem with git though. I don't think it's the command-line interface that's hostile, it's git itself if you don't know what you're doing. After taking some time to learn it I actually enjoy solving difficult problems with git.



Long ago someone taught me this memory trick for tar: imagine an angry German stereotype saying “eXtract Ze Vucking File”, thus -xzvf. No idea what it stands for but it does what I need most of the time.


x = extract, z = compress/decompress, v = verbose (list files added or extracted), f = filename follows.

You can leave off the 'z' if it's a tar without compression. If it's compressed, the extension is usually tgz, tar.Z, bz2, or something else other than tar.

You can leave off the 'v' if you don't want to see a list of which files are being added or extracted.


In recent versions of (maybe only GNU?) `tar` you can leave off the `z` flag and it will still decompress based on the filename.


Or just replace the z with an a. That's what I mainly use.


Yeah, extractors/compressors are so bad i ended up hacking my own interface over the common utilities in python (i called it tzar because it's tar, zip, anything really).


A very handy tool for this is https://www.nongnu.org/atool/


Relevant xkcd comic: https://xkcd.com/1168/


That's something I never understood. I learned tar -xvf young, and that's the only command I've ever used, and it works every time.


I interpreted the comic as meaning not any old tar command line, but a command line for a specific intended purpose. I had a job interview once with a test consisting of a whole list of 20 unix questions, one of which was "you need to do x, y and z in tar, what's the command line?". I got about 5 of them, but spent the 5 minutes critiquing the test and suggesting ways to improve it. I got the job. Apparently my 5 answers were the best anybody got anyway.


That's interesting, I always interpreted it as "enter any valid tar command".


That's the most obvious interpretation, but it doesn't really make much sense. At the end of the day, I suppose it's just a joke that tar command line arguments are bizarre and arcane.


tar --version


tar -czf ./file.tgz ./*

edit: i do hope that is correct without checking :-)


So the dash in `-czf` if optional? Which reminds me: why does ps have two sets of options again?


Don't laugh, it's actually three sets of options now:

- UNIX options, which may be grouped and must be preceded by a dash.

- BSD options, which may be grouped and must not be used with a dash.

- GNU long options, which are preceded by two dashes.

Reference: https://man7.org/linux/man-pages/man1/ps.1.html


As an alternative to atool I've always used The Unarchiver's cli version[0] which has been able to handle basically anything I've thrown at it correctly.

[0]: https://theunarchiver.com/command-line


This is a pain in the GUI tools as well


May I suggest to use “zipinfo” or “tar -t” to check the contents of the archive before extracting




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: