0

This is one of those things I don't quite do often enough to memorize. I thought it would be nice to have the answer here so I (and maybe others with as poor a memory as me) can star it.

What command-line options to I use to un-tar a tar.gz file into a specific directory, on Linux?

Daryl Spitzer
  • 2,996
  • 9
  • 33
  • 40
  • 1
    You can't even memorise "man tar"? – John Gardeniers May 21 '10 at 22:21
  • @John, as an infrequent *nix user, I despise the `man` pages on the occasions when I'm forced to read them. Most of them read like you already have a comp-sci degree, or you already know the intracacies of their software (in which case you're just after a refresher, not a learning experience) – Mark Henderson May 21 '10 at 22:38
  • @Farseeker, I won't argue what you said about man pages (I probably use *nix less that you do) but given the choice of using man or remembering a URL to a page with the same info I know where I'll turn first. – John Gardeniers May 22 '10 at 06:36
  • I've found that every time I ask a question here (no matter how easy it is to look up the answer somewhere else) I learn something. This time, so far, I learned about the multiple v method for specifying "verbosity". – Daryl Spitzer May 23 '10 at 13:08
  • John, now we've created a web page that may show up on a Google search for *nix newbies who wouldn't necessarily even know to try `man tar`. – Daryl Spitzer May 23 '10 at 13:10

2 Answers2

3
tar xzf file.tgz -C directory

But directory must be created before you can fill it If you don't define -C, it is extract in the current directory

Dom
  • 6,743
  • 1
  • 20
  • 24
0

From man tar:

   tar -xvvzf foo.tar.gz
          extract gzipped foo.tar.gz
Daryl Spitzer
  • 2,996
  • 9
  • 33
  • 40
  • I don't understand why -v is specified twice. Is that a typo? – Daryl Spitzer May 21 '10 at 19:17
  • 1
    -v : just the names of the files -vv : names + informations like size, owner, rights... – Dom May 21 '10 at 19:43
  • many commands use the multiple v method for defining just how verbose you want to be, the more vs, the more detail is displayed. the upper limit depends on each program though. – ManiacZX May 21 '10 at 19:52