Sunday, 25 December 2011

Tar File — Read and write tar archive files

Hello friends,
   In this post i am going to explain about tar files and how to create tar files.
  
A tar file is the concatenation of one or more files. Each file is preceded by a 512-byte header record. The file data is written unaltered except that its length is rounded up to a multiple of 512 bytes and the extra space is zero filled. The end of an archive is marked by at least two consecutive zero-filled records

Uncompressed tar archive files have names ending in ".tar". Unlike ZIP archives, tar files (somefile.tar) are commonly compressed as a whole rather than piecemeal.Applying a compression utility such as gzip, bzip2, xz, lzip, lzma, or compress to a tar file produces a compressed tar file, typically named with an extension indicating the type of compression (e.g., somefile.tar.gz).
  USAGE ----------

    tar -czf whatever.tar foldername
   
     another method would be…
  
     tar -czf whatever.tar.gz foldername

If you’d like to tar your file and have it put in another location use this:

    tar -czf /directory/directory/whatever.tar foldername
Here are a list of tar options, and their significance.
-c = create
-f = read to/from the named file (instead of the device /tape)
-t = list contents of .tar file
-r = append to a .tar file
-v = verbose (tells you everything its doing)
-x = extract contents of .tar file
-z = compress files
To extract the files form file

tar -xf whatever.tar  

No comments:

Post a Comment