[LBo] Displaying Directories
Anita Lewis
a.lewis at linuxbasics.org
Tue Jul 17 17:38:39 CEST 2007
David Roseman wrote:
> sorry for being picky, but in this line
>
> If you see this .tar.bz2 file, you need to extract it using "tar xvfj
> whatever-filename.tar.bz2"
>
> the command should be tar -xvfj <filename>
>
> Dave
Actually it is a little more complex than saying one or the other is
correct.
See: http://www.gnu.org/software/tar/manual/tar.html#Long-Options
and http://www.gnu.org/software/tar/manual/tar.html#Short-Options
and http://www.gnu.org/software/tar/manual/tar.html#Old-Options
Many of us are used to tar without using the '-' It looks like they have
moved over to using the hyphen, maybe to be like all the other commands.
I'll have to really read the above manual myself.
Here is the part that seems to pertain to this discussion:
---------------
This old way of writing tar options can surprise even experienced users.
For example, the two commands:
tar cfz archive.tar.gz file
tar -cfz archive.tar.gz file
are quite different. The first example uses archive.tar.gz as the value
for option 'f' and recognizes the option 'z'. The second example,
however, uses z as the value for option 'f' - probably not what was
intended.
Old options are kept for compatibility with old versions of tar.
This second example could be corrected in many ways, among which the
following are equivalent:
tar -czf archive.tar.gz file
tar -cf archive.tar.gz -z file
tar cf archive.tar.gz -z file
-------------------
The above is about creating a tar.gz instead of untarring. It also uses
'z' instead of 'j' for creating a .gz instead of .bz2, but the basic
idea is there.
I learned to put the 'f' at the end even when I was using the old tar;
so either way, I should be good. But honestly, we used to get a little
warning message with the hyphen in the command. Funny how things
change. I'm glad you brought this up. I'm going to try the command
your way with the 'j' at the end and also with it in the second position
where I normally put it. Then I'll try it backwards creating the file.
Anita
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 250 bytes
Desc: OpenPGP digital signature
Url : http://LinuxBasics.org/pipermail/qna/attachments/20070717/09014ccc/attachment.pgp
More information about the QnA
mailing list