LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-12-2011, 10:57 AM   #1
gardenair
Member
 
Registered: Oct 2004
Location: LH
Posts: 648

Rep: Reputation: 45
How to extract a tar file ?


hi,
I have downloaded squid2.6.STABLE23.tar.gz file. I want to untar the file. The file is located in /home.
Kindly guide me that how can I untar the file so I may install the software.
thanks
garden
 
Old 03-12-2011, 11:00 AM   #2
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hello,

Tar understands the gz extension so just untar it:
Code:
tar xvf squid2.6.STABLE23.tar.gz
That will create a directory in your /home with the contents of the package in it. For more information on tar and how to use it have a look at the man page:
Code:
man tar
Kind regards,

Eric
 
Old 03-12-2011, 11:01 AM   #3
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
First, it's better to use the package manager to install software.
If however the latest squid isn't available, and you really need it:

open a terminal
type
Code:
tar xvzf squid2.6.STABLE23.tar.gz
cd to the created directory and read the readme files


Kind regards
 
Old 03-12-2011, 11:01 AM   #4
MS3FGX
LQ Guru
 
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Rep: Reputation: 361Reputation: 361Reputation: 361Reputation: 361
You would use a command like:

Code:
tar -zxvf squid2.6.STABLE23.tar.gz
That will decompress and extract the entire archive, and display a listing of what files were extracted.
 
Old 03-12-2011, 11:04 AM   #5
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Quote:
Originally Posted by repo View Post
First, it's better to use the package manager to install software.
Hi repo,

You're right to advice that but the OP wants to compile Squid with some options that don't come with the default installation performed through a package manager. I happen to encounter his previous thread asking how to recompile Squid to include some option he doesn't have.

Kind regards,

Eric
 
Old 03-12-2011, 11:50 AM   #6
gardenair
Member
 
Registered: Oct 2004
Location: LH
Posts: 648

Original Poster
Rep: Reputation: 45
thanks all of you for the replies. Well after downloading squid-2.6.STABLE23.tar.gz in my /home I create a new folder folder and copy keep the file in it simple.

Code:
[roor@localhost myfolder]#ls 
squid-2.6.STABLE23.tar.gz
[roor@localhost myfolder]#
Now I use tar command to untar
Code:
[roor@localhost myfolder]# tar cfv squid-2.6.STABLE23.tar.gz
tar:Cowardly refusing to create an empty archive
Try tar --help for more infomation
[roor@localhost myfolder]#
The code is correct which I write. I have also read the man but still confuse why it is not untar the file. I also use the rest for the command but it simply give an error message.
Kindly try from your own endby download the same file ,guide me how to untar it so I may follow it

thanks a lot for help
garden
 
Old 03-12-2011, 11:53 AM   #7
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
You need the xvzf option, since it's a tar.gz file
Code:
tar xvzf squid-2.6.STABLE23.tar.gz
the cvf is to create an archive.

Kind regards
 
Old 03-12-2011, 12:02 PM   #8
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2021 CentOS7.9 + 50+ other Linux OS, for test only.
Posts: 17,483

Rep: Reputation: 3633Reputation: 3633Reputation: 3633Reputation: 3633Reputation: 3633Reputation: 3633Reputation: 3633Reputation: 3633Reputation: 3633Reputation: 3633Reputation: 3633
Quote:
You need the xvzf option
tar xvf will do ( Unless you are using CentOS4 and older ..)

From /usr/doc/tar-1.15.1/NEWS , slack 10.2
Quote:
version 1.15 - Sergey Poznyakoff, 2004-12-20

* Compressed archives are recognised automatically, it is no longer
necessary to specify -Z, -z, or -j options to read them.
( Thus, you can now run `tar tf archive.tar.gz'.)

Last edited by knudfl; 03-12-2011 at 12:03 PM.
 
1 members found this post helpful.
Old 03-12-2011, 12:05 PM   #9
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
Quote:
tar xvf will do
Old habits won't die ;-)
Thank you

Kind regards
 
Old 03-12-2011, 12:07 PM   #10
gardenair
Member
 
Registered: Oct 2004
Location: LH
Posts: 648

Original Poster
Rep: Reputation: 45
well still no success
Code:
[roor@localhost myfolder]# tar xvzf squid-2.6.STABLE23.tar.gz

gzip: stdin: not in gzip format
tar: child returned status 1
tar: myfolder: not found in archive
tar: Error exit delayed from previous error
[roor@localhost myfolder]#

I also have tried xvf option but nothing happen...I think If you do it in your pc you will much batter guide me.
thanks again for the guidance.
garden

Last edited by gardenair; 03-12-2011 at 12:09 PM.
 
Old 03-12-2011, 12:12 PM   #11
MS3FGX
LQ Guru
 
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Rep: Reputation: 361Reputation: 361Reputation: 361Reputation: 361
Perhaps the download is corrupt? Did you try to download it again? Is there an MD5 sum you can verify?
 
Old 03-12-2011, 12:41 PM   #12
gardenair
Member
 
Registered: Oct 2004
Location: LH
Posts: 648

Original Poster
Rep: Reputation: 45
Well the download size is also ok. This time i download bz2 file and use following command

Code:
[roor@localhost myfolder]# tar xjf squid-2.6.STABLE23.tar.bz2
[roor@localhost myfolder]#
No error and it create a new folder with same name containg all files in it.
But the issue is same it as why [roor@localhost myfolder]# tar xvzf squid-2.6.STABLE23.tar.gz
give error ?
The download file is correct according to its size.I am really confuse where is the issue

Last edited by gardenair; 03-12-2011 at 12:44 PM.
 
Old 03-12-2011, 12:49 PM   #13
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
What is the output of the following command?
Code:
file squid-2.6.STABLE23.tar.gz
This should tell you if it is actually a gzipped file or just an uncompressed tar archive. In any case, without using the unnecessary -z option (as already pointed out), try
Code:
tar tvf squid-2.6.STABLE23.tar.gz
Note the t option: it should list the content of the archive without extracting it.
 
Old 03-12-2011, 12:50 PM   #14
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hello,

As pointed out in post #2 the tar command can handle regular compressed files (the gz extension which implicates it's compressed with the GNU zip algorithm), hence you don't need to specify the z when you extract those files but just:
Code:
tar xvf <yourfile>
where the x stands for eXtract, the v for verbose and the f to indicate using a file. When you used the z flag you got the error because it's not necessary to use it.
When you downloaded the other type (bz2 extension which indicates it's compressed using BZip2 algorithm which is different from GNU zip) you needed to explicitly tell tar so with the z option.

So, basically,

gz = no need for the z parameter since tar itself handles it.
bz2 = you do need to indicate by using the z parameter which algorithm to use.

I hope that clears up some things.

Kind regards,

Eric
 
Old 03-12-2011, 12:55 PM   #15
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Quote:
Originally Posted by EricTRA View Post
Hello,When you downloaded the other type (bz2 extension which indicates it's compressed using BZip2 algorithm which is different from GNU zip) you needed to explicitly tell tar so with the z option.
Hi Eric! Actually it is the j option for bzip2 compression algorithm. On my system, using GNU tar 1.23, it is not necessary anymore, as well.
 
1 members found this post helpful.
  


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
extract file from tar ust Linux - Newbie 8 03-31-2009 08:23 AM
how to extract tar.gz file ???/ wahaha Linux - Software 6 10-27-2007 09:33 AM
extract tar.gz file manolakis Linux - Newbie 3 11-13-2006 11:49 AM
can not extract the tar.gz file sharad durgawad Linux - Software 3 10-05-2005 03:41 AM
How to extract a tar.gz file? deWin Linux - Newbie 3 11-10-2004 12:24 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:23 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
Open Source Consulting | Domain Registration