Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
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 6: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 Answers 2

up vote 3 down vote accepted
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

share|improve this answer

From man tar:

   tar -xvvzf foo.tar.gz
          extract gzipped foo.tar.gz
share|improve this answer
    
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.