Author Topic: Archive and Source  (Read 1250 times)

pkd_lives

  • Member
  • **
  • Posts: 554
  • Kudos: 0
Archive and Source
« on: 2 November 2002, 04:37 »
I feel stupid asking this as I feel I should know it.

Is tar(ball) the source code of a program? If so what is specific to make it a tarball as opposed to a listing.

And I thought tarballing was a way of archiving, so what is zip (gz or bz2) doing that tarball doesn't - Just emptying the spare zeros from the code listing?

Now in addition does the following answer true?

gzip -d [package.name].tar.gz
tar -xvf [package.name].tar

is equivalent to

tar -xvzf [package.name].tar.gz
(with a j instead of a z for bz2)

If someone could help clarify these issues I would be most grateful.
Tough - Adapt or die : Read The Fucking Manual.

Local Area Network in Australia: the LAN down under.


flap

  • Member
  • **
  • Posts: 1,268
  • Kudos: 137
Archive and Source
« Reply #1 on: 2 November 2002, 05:00 »
A tar file is just a single file containing a number of other files, like a zip file but without compression - it's not specific to source code. Tar files are filtered through a utility like gzip in order to compress them.

Yes, they're equivalent.
"While envisaging the destruction of imperialism, it is necessary to identify its head, which is none other than the United States of America." - Ernesto Che Guevara

http://counterpunch.org
http://globalresearch.ca


voidmain

  • VIP
  • Member
  • ***
  • Posts: 5,605
  • Kudos: 184
    • http://voidmain.is-a-geek.net/
Archive and Source
« Reply #2 on: 2 November 2002, 05:35 »
"tar" actually stands for "Tape Archive" as it was created originally to dump/stream files and file systems to tape. Since a tape device (or any other device) in unix is accessed via a file name that is open/closed and written to much like any other file you can give tar any name and it will happily stream that data to a regular file just as it does to a tape device (I love UNIX).

"tar" files also store the ownership, permissions, type, time and date of the files that are archived so you can restore them to the exact state that they were when you archived them. When networking became popular it was easier to transfer smaller file archives over the network rather than snail mailing someone a tape. Compressing the archive makes it take up less disk/tape space. Together tar and gzip/bzip/compress are much like zip.

But maybe that's more than you wanted to know. And it has nothing to do with what is contained inside it (tar.gz != source code).

[ November 01, 2002: Message edited by: void main ]

Someone please remove this account. Thanks...

Kintaro

  • Member
  • **
  • Posts: 6,545
  • Kudos: 255
  • I want to get the band back together!
    • JohnTate.org
Archive and Source
« Reply #3 on: 2 November 2002, 06:19 »
Yea you could tar/bzip2 directly to a Hard Disk so you get extra space (and no formatting).

I have an old tape drive here of a Mainframe, but i need to read the documentation so i can hook it upto a PC.

voidmain

  • VIP
  • Member
  • ***
  • Posts: 5,605
  • Kudos: 184
    • http://voidmain.is-a-geek.net/
Archive and Source
« Reply #4 on: 2 November 2002, 07:35 »
quote:
Originally posted by Ex Eleven / b0b 2.1:
Yea you could tar/bzip2 directly to a Hard Disk so you get extra space (and no formatting).


If you want to do that you might as well run a compressed file system.

 
quote:
I have an old tape drive here of a Mainframe, but i need to read the documentation so i can hook it upto a PC.


Is it a 1/2" 9 track tape?  We had around 100,000 of them in our mainframe library. But those tape drives couldn't be hooked up to a PC, they were connected to the mainframe via "bus & tag" cables. Those cables are "huge". And the drives we had were over 6 feet tall and about 3 feet wide by about 3 feet deep. But I have seen 9 track drives that would hook up to a PC and read mainframe tapes.
Someone please remove this account. Thanks...

Master of Reality

  • VIP
  • Member
  • ***
  • Posts: 4,249
  • Kudos: 177
    • http://www.bobhub.tk
Archive and Source
« Reply #5 on: 2 November 2002, 07:57 »
whats the difference between zip, gzip, and bzip(2)??
Disorder | Rating
Paranoid: Moderate
Schizoid: Moderate
Linux User #283518
'It takes more than a self-inflicted gunshot wound to the head to stop Bob'

Kintaro

  • Member
  • **
  • Posts: 6,545
  • Kudos: 255
  • I want to get the band back together!
    • JohnTate.org
Archive and Source
« Reply #6 on: 2 November 2002, 08:04 »
gzip fast
bzip2 slow
gzip reasonable compression
bzip2 brilliant compression.
zip reasonable compression and speed.

voidmain

  • VIP
  • Member
  • ***
  • Posts: 5,605
  • Kudos: 184
    • http://voidmain.is-a-geek.net/
Archive and Source
« Reply #7 on: 2 November 2002, 08:12 »
quote:
Originally posted by The Master of Reality / B0B:
whats the difference between zip, gzip, and bzip(2)??


Well, the difference between zip and gzip is "g". The difference between zip and bzip is "b". The difference between gzip and bzip is a little more complex. I'll have to think about that one for a while.      

Actually gzip, bzip, and bzip2 are all designed to compress a single file or a stream. They each use different compression algorithms, some better for compression, some better for speed. These also are good for streaming compression. zip has a couple of different algorythms based on passed options, also can archive multiple files, can do encryption, etc. zip is not designed for compressing streams.

[ November 01, 2002: Message edited by: void main ]

Someone please remove this account. Thanks...

pkd_lives

  • Member
  • **
  • Posts: 554
  • Kudos: 0
Archive and Source
« Reply #8 on: 2 November 2002, 08:26 »
Ahhh....Now it all makes a lot more sense - I like that streaming file idea, it somehow feels natural, like so much in UNIX.

Thanks all who have responded. That has added several pieces of useful information to my knowledge base. And Void..far from being too much the answers I received in this thread are EXACTLY what I wanted and needed to know. I can handle these files on a normal basis just by typing a command, but I have that engineers NEED to know what is happening...You know what I mean, and I'm sure you do?

So to get it straight, tar was a way of streaming data to a file, but now it's used primarily to preserve data formats, and permissions, file structures, and the essentials for dealing with the enclosed source code of the file, whilst the zips perform those nice tasks of compressing the data so that it is not huge files.

I guessed it was the equivalent of PK and Win zip, but it's the difference between guessing and learning that seperates the boys from the men.
Tough - Adapt or die : Read The Fucking Manual.

Local Area Network in Australia: the LAN down under.


voidmain

  • VIP
  • Member
  • ***
  • Posts: 5,605
  • Kudos: 184
    • http://voidmain.is-a-geek.net/
Archive and Source
« Reply #9 on: 2 November 2002, 08:42 »
quote:
Originally posted by pkd:
So to get it straight, tar was a way of streaming data to a file, but now it's used primarily to preserve data formats, and permissions, file structures, and the essentials for dealing with the enclosed source code of the file, whilst the zips perform those nice tasks of compressing the data so that it is not huge files.



Well, it works just as well (or better) than zip for archiving source code but it certainly has not left as a tool used for archiving to tape. In fact I used tar to back my computer up to my Video camera just today. I use it to back up to DLT drives too. Source code is one thing that you want to be able to "archive" and distribute. "cpio" is another utility used for backups and creating archives but less commonly used.

And a simple example of compressing a stream would be:

# tar -cvf - somedir | gzip | dd of=/dev/tape obs=512

Of course with GNU tar you can just do:

# tar --block-size 1 -cvzf /dev/tape somedir

to do the same thing. You can't do that with zip/pkzip/winzip.

[ November 01, 2002: Message edited by: void main ]

Someone please remove this account. Thanks...