LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-02-2007, 10:38 AM   #1
huangyongqiang
LQ Newbie
 
Registered: Oct 2007
Distribution: opensuse 10.3
Posts: 11

Rep: Reputation: 0
How to use tar?


hello, I'm a newbie on linux.I've just downloaded a file whose name ends with .tar.gz.
I've tried
tar zxvf filename
to extract it, but failed and received note which said no files or directories etc.
Can anyone help me how to solve the problem?
 
Old 10-02-2007, 10:41 AM   #2
marco18
Member
 
Registered: Jul 2007
Location: Argentina
Distribution: Ubuntu 13.04 , Debian Lenny 5.0.7
Posts: 223

Rep: Reputation: 21
If you typed as you wrote above, it is wrong. You forgot the slash before the mods. Type this:

tar -zxvf filename.tar.gz


Hope this can help.
 
Old 10-02-2007, 10:44 AM   #3
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,823

Rep: Reputation: 611Reputation: 611Reputation: 611Reputation: 611Reputation: 611Reputation: 611
on some tars you don't need the hyphen (like eg mine). huangyongqiang, if you could paste exactly what you typed and what you got back that would be great.
 
Old 10-02-2007, 10:51 AM   #4
b0uncer
LQ Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
Code:
tar -xzvf filename.tar.gz
x for extraction (rather than archiving), z for gzip comperssion, v for verbose output and f for "filename" (the filename must be right after letter 'f', separated by a space).

Code:
tar -xjvf filename.tar.bzip2
The same, but now the .tar file is compressed with bzip2 (and not gzip), so use option 'j' instead of 'z' to tell tar which uncompression to use.

More:
Code:
man tar
It would also work if you first uncompressed, then untarred:
First code (from above) would be like this:
Code:
gunzip filename.tar.gz
tar -xvf filename.tar
So 'gunzip' first un-gzips the compressed archive (a .tar file comes out) and then tar untars that .tar file (note that there's no 'x' in the options anymore, because there's no need to gunzip it anymore!)

The second codepiece (from the top) would also work as
Code:
bunzip2 filename.tar.bz2
tar -xvf filename.tar
And so on..got it?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how can i decompress this tar.tar file? hmmm sounds new.. tar.tar.. help ;) kublador Linux - Software 14 10-25-2016 02:48 AM
tar tar cvf - . | (cd /root/; tar xvf -) ewt3y Linux - General 10 02-19-2014 10:55 AM
BackUp & Restore with TAR (.tar / .tar.gz / .tar.bz2 / tar.Z) asgarcymed Linux - General 5 12-31-2006 02:53 AM
tar | ssh (tar > .tar) syntax issues EarlMosier Linux - Software 6 12-21-2006 12:28 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:17 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration