[LBo] Displaying Directories
Brian Reichert
rignes at pobox.com
Tue Jul 17 21:33:07 CEST 2007
* Anita Lewis <a.lewis at linuxbasics.org> [2007-07-17 11:38:39-0400]
> 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.
This is all very interesting. I never put much thought into it, but it makes
total sense. I've always just used
tar czvf archive.tar.gz filetoarchive
as that's what was discussed in my Running Linux book. At that point I always
thought that it was odd not requiring the - like everything else under the sun
seems to.
It's nice to know the differences.
--
Brian Reichert
http://rignesnet.tzo.com
This is an unauthorized cybernetic announcement.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://LinuxBasics.org/pipermail/qna/attachments/20070717/6c6ae1bb/attachment.pgp
More information about the QnA
mailing list