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

Nice list of stuff, especially for people relatively new to command line stuff

there's a cool twitter account called "Command Line Magic" (https://twitter.com/climagic) that does some fun stuff, and is pretty shell-agnostic.

Also, for those willing to, I'd strongly suggest checking out fish. it's not bash-compatible, but there's a lot of good usability aspects to it (especially compared to vanilla bash), I love it.

Out of curiosity though, this command : tar zxvf package.tar.gz -C new_dir

it's always intrigued me that the tar command (I imagine it is mainly used to "unzip" things) does not make it very simple to do this. I've started to memorize the 4-letter combo but for a while I had to google it everytime (man pages are not useful for learning things for a lot of unix cl tools).



tar is not a compression program per se, but a file archiving tool. It is used because it preserves file system information such as permissions, owner and group, which would otherwise be lost if you used zip/gzip/bzip alone. Each letter has a meaning, x is for extract, f is file, v is verbose (print details to screen) and f is for file. So the cryptic four letters are really easy to rememeber: eXtract the Zip File Verbosely. Change the x for a c (Create) and you can make a new file.


I was going to ask what is wrong with the man page (because in my experience they do a mighty fine job of explaining most traditional unix tools). But then I checked the manuals for two variants of tar (gnu and obsd), and I can see how they might appear less than helpful for a new user who has never dealt with gzip before.

I am surprised the xz(v)f invocation isn't in the examples. I could've sworn it's there...


I almost always try info instead of man because that's where I'll find common use cases of tools (when the info page exists).

man is obviously useful when you want to know what one switch does, but there are a lot of tools that could use an introductory "how to use"


> it's always intrigued me that the tar command (I imagine it is mainly used to "unzip" things) does not make it very simple to do this.

It helps to remember that tar stands for Tape ARchiver (or Tape ARchive, or something, depending on who you ask), and that its interface really does date from the era when dealing with tape was a common task for pretty much any sysadmin.


The mnemonic that I've ran across that has been helpful for this is feigning a horrible German accent and saying "eXtract Ze File!"


That's funny! i just remember it as eXtract gZip File, no accents necessary!




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

Search: