LinuxQuestions.org
Help answer threads with 0 replies.
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 05-12-2011, 08:54 AM   #1
archana485
LQ Newbie
 
Registered: May 2011
Posts: 3

Rep: Reputation: 0
Tar option -j not working in different versions of Linux


Hi,

I am trying to untar a bzip2 tar file on different versions of linux. The tar options that i provide to extract the file are same. However it fails for one verison but works for another.

Below is the details of the Linux server and the tar command that i use to untar the archive:

1)
Linux release 2.4.21-50.ELsmp #1 SMP Tue May 8 17:18:29 EDT 2007
Code:
/u/archana> tar --version
tar (GNU tar) 1.13.25
Copyright (C) 2001 Free Software Foundation, Inc.
This program comes with NO WARRANTY, to the extent permitted by law.
You may redistribute it under the terms of the GNU General Public License;
see the file named COPYING for details.
Written by John Gilmore and Jay Fenlason.


/u/archana> tar xvvjf netty-3.1.5.GA-dist.tar.bz2
drwxr-xr-x 0/0               0 2009-10-12 16:33:31 netty-3.1.5.GA/license/
drwxrwxr-x                  Creating directory: netty-3.1.5.GA
drwxr-xr-x 0/0               0 2009-10-12 16:33:49 netty-3.1.5.GA/src/
drwxr-xr-x 0/0               0 2009-10-12 16:33:49 netty-3.1.5.GA/src/argouml/
drwxr-xr-x 0/0               0 2009-10-12 16:33:31 netty-3.1.5.GA/src/assembly/
drwxr-xr-x 0/0               0 2009-10-12 16:33:35 netty-3.1.5.GA/src/docbook/
drwxr-xr-x 0/0               0 2009-10-12 16:33:35 netty-3.1.5.GA/src/docbook/css/
drwxr-xr-x 0/0               0 2009-10-12 16:33:35 netty-3.1.5.GA/src/docbook/en-US/
drwxr-xr-x 0/0               0 2009-10-12 16:33:35 netty-3.1.5.GA/src/docbook/en-US/module/
drwxr-xr-x 0/0               0 2009-10-12 16:33:34 netty-3.1.5.GA/src/docbook/images/
drwxr-xr-x 0/0               0 2009-10-12 16:33:35 netty-3.1.5.GA/src/docbook/xslt/
2) Red Hat Enterprise Linux ES release 4 (Nahant Update 5)
Kernel 2.6.9-55.ELsmp on an i686

Code:
/u/archana>tar (GNU ccm_tar) 1.13

Copyright (C) 1988, 92,93,94,95,96,97,98, 1999 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Written by John Gilmore and Jay Fenlason.




/u/archana> 
tar xvvjf netty-3.1.5.GA-dist.tar.bz2
tar: invalid option -- j
Try `tar --help' for more information
Can anyone tell me what is the equivalent option in Linux RHEL4 for -j option to untar bzip2 archives ?
 
Old 05-12-2011, 08:57 AM   #2
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,204

Rep: Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611
Have you tried using 'gtar' on RHEL4 instead of 'tar'?
 
Old 05-12-2011, 09:02 AM   #3
SL00b
Member
 
Registered: Feb 2011
Location: LA, US
Distribution: SLES
Posts: 375

Rep: Reputation: 112Reputation: 112
You could always try invoking bunzip2 directly, then untarring the result.
 
Old 05-12-2011, 09:12 AM   #4
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,505

Rep: Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890
My first question would be why are you using such dated versions??

Other than that, does man tar not tell you if the option is available or not? Or what it should be should it have changed?
 
Old 05-12-2011, 04:21 PM   #5
jake3988
Member
 
Registered: Mar 2005
Location: Ohio
Distribution: Freebsd and Ubuntu
Posts: 69

Rep: Reputation: 17
Most linux distros use built packages like rpm or deb (red hat is rpm distro) and the package is built with only the options that the person who built it enabled. This is obviously different depending on what you installed.

If you want a certain option and your distro's package does not offer it, you'll have to compile it by hand or live without that option.

If you want to know if you have it or not, man it. The man pages are built based upon the options selected. If it's not listed, you don't have that option available.
 
Old 05-24-2011, 04:54 AM   #6
ruario
Senior Member
 
Registered: Jan 2011
Location: Oslo, Norway
Distribution: Slackware
Posts: 2,188

Rep: Reputation: 1184Reputation: 1184Reputation: 1184Reputation: 1184Reputation: 1184Reputation: 1184Reputation: 1184Reputation: 1184Reputation: 1184
Change:
Code:
tar xvvjf netty-3.1.5.GA-dist.tar.bz2
To:
Code:
bzip2 -cd netty-3.1.5.GA-dist.tar.bz2 | tar -xvvf-
 
Old 05-24-2011, 05:00 AM   #7
ruario
Senior Member
 
Registered: Jan 2011
Location: Oslo, Norway
Distribution: Slackware
Posts: 2,188

Rep: Reputation: 1184Reputation: 1184Reputation: 1184Reputation: 1184Reputation: 1184Reputation: 1184Reputation: 1184Reputation: 1184Reputation: 1184
Quote:
Originally Posted by grail View Post
My first question would be why are you using such dated versions??
It is the RHEL 4.* series, which initially came out more than 6 years ago (but is still supported by Red Hat), so it may well have come with that old version of tar. There were more recent versions of tar available at the time but several of tar versions immediately after tar 1.13 where quite buggy and hence would have no place in a distro optimised for servers. So I suspect that Red Hat selected this as the last safe version available at the time when RHEL 4 came out.
 
Old 05-24-2011, 06:54 AM   #8
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978
On older versions the option to manage bzipped2 tar archives was --bzip2. The short option -j has been introduced later, but the long version has been maintained for compatibility. Maybe on the RH machine you can (successfully) try
Code:
tar xvvf netty-3.1.5.GA-dist.tar.bz2 --bzip2
 
Old 05-24-2011, 08:26 AM   #9
ruario
Senior Member
 
Registered: Jan 2011
Location: Oslo, Norway
Distribution: Slackware
Posts: 2,188

Rep: Reputation: 1184Reputation: 1184Reputation: 1184Reputation: 1184Reputation: 1184Reputation: 1184Reputation: 1184Reputation: 1184Reputation: 1184
It'll probably work but having bzip2 do the initial decompress and pipe the result to tar is still the safest method as it works as long as the bzip2 command is present, with all tar implementations (GNU tar, BSD tar, Solaris tar, Schily's tar, etc.), even really old versions.
 
  


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
Can't make SO_RCVLOWAT socket option working under LINUX? jf.argentino Programming 2 09-03-2009 09:51 AM
tar option Paxmaster Linux - Software 1 11-16-2005 06:27 AM
tar -C option ? shanenin Linux - Software 3 07-25-2004 09:36 PM


All times are GMT -5. The time now is 02:58 AM.

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