Tar: Difference between revisions

[unchecked revision][unchecked revision]
Content deleted Content added
USTAR note: correct grammar and fill in details.
m Fix typo from a previous edit
Line 23:
As you can see the header is not 512 bytes big so the rest of the header is padded up with zeros. At the end of the tar file there is a header of 512 bytes filled with only zeros to indicate the end. (There may be more empty headers to pad to the tape block size; ustar format specifies 10KiB blocks.) A header contains a lot of information but for this tutorial we'll only be interested in two of them.
 
Filename: This actually contains the whole path, not only the file. It ends with the '\0' character. If 100 bytes is not enough, the ustar format supports longer names by a more complicated mechanism not covered here. Caution: paths of 100 bytes or longer may not be terminated with '\0'.
 
Size: This contains the size of the file. Important to note here is that the size is in base 8 and written using ascii characters so when you try to figure out the size you must keep this in mind. Actually all fields containing numbers uses this not just size. This is a code snippet that calculates this for you: