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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
|
03-12-2011, 09:57 AM
|
#1
|
Member
Registered: Oct 2004
Location: LH
Posts: 648
Rep:
|
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
|
|
|
03-12-2011, 10:00 AM
|
#2
|
LQ Guru
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
|
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:
Kind regards,
Eric
|
|
|
03-12-2011, 10:01 AM
|
#3
|
LQ 5k Club
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529
|
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
|
|
|
03-12-2011, 10:01 AM
|
#4
|
LQ Guru
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852
|
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.
|
|
|
03-12-2011, 10:04 AM
|
#5
|
LQ Guru
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
|
Quote:
Originally Posted by repo
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
|
|
|
03-12-2011, 10:50 AM
|
#6
|
Member
Registered: Oct 2004
Location: LH
Posts: 648
Original Poster
Rep:
|
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
|
|
|
03-12-2011, 10:53 AM
|
#7
|
LQ 5k Club
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529
|
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
|
|
|
03-12-2011, 11:02 AM
|
#8
|
LQ 5k Club
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,520
|
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 11:03 AM.
|
|
1 members found this post helpful.
|
03-12-2011, 11:05 AM
|
#9
|
LQ 5k Club
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529
|
Old habits won't die ;-)
Thank you
Kind regards
|
|
|
03-12-2011, 11:07 AM
|
#10
|
Member
Registered: Oct 2004
Location: LH
Posts: 648
Original Poster
Rep:
|
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 11:09 AM.
|
|
|
03-12-2011, 11:12 AM
|
#11
|
LQ Guru
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852
|
Perhaps the download is corrupt? Did you try to download it again? Is there an MD5 sum you can verify?
|
|
|
03-12-2011, 11:41 AM
|
#12
|
Member
Registered: Oct 2004
Location: LH
Posts: 648
Original Poster
Rep:
|
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 11:44 AM.
|
|
|
03-12-2011, 11:49 AM
|
#13
|
LQ Guru
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509
|
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.
|
|
|
03-12-2011, 11:50 AM
|
#14
|
LQ Guru
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
|
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:
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
|
|
|
03-12-2011, 11:55 AM
|
#15
|
LQ Guru
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509
|
Quote:
Originally Posted by EricTRA
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.
|
All times are GMT -5. The time now is 08:38 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|