San Diego State University logo

*Technical Briefs*
ROHAN help Files

----------------------------------------------------------------------

archive options

An archive is a single, usually compressed file that contains many related files and directories. Most files available on ftp sites, bulletin boards, etc. are distributed as archives. This is mainly because only one file transfer operation is required to get all the files, and, if the files are also compressed, the transfer time is lessoned because of the significant reduction in size.

The most commonly used UNIX archive format is tar. tar does not compress files, it only groups them into an archive that can contain many files and directories. tar allows the user to send complete directories that include binary files and links while preserving the file ownership and access permissions.

To create a tar archive, at the ROHAN prompt type:

rohan% tar  cf  newfile.tar  directoryname/*

This command creates a new file named newfile.tar that contains all of the files and information that is contained in the directory called directoryname.

To create a compressed archive, the gzip or the compress commands can be used on the tar file to significantly reduce its size. When gzip and compress process a file, they replace it with a compressed file that has a .GZ extension (gzip) or a .Z extension (compress).

NOTE: The compress command is the old UNIX standard that is still used today, but gzip is more commonly used and is compatible with the old compress format.

To compress the file named work.tar, at the ROHAN prompt type:

rohan% gzip  work.tar

or

rohan% compress  work.tar

The file work.tar will now be replaced with a compressed file named work.tar.GZ or work.tar.Z.

To compress a copy of the file, type:

rohan% gzip  -c  work.tar  >  done.tar.GZ

or

rohan% compress  -c  work.tar  >  done.tar.Z

This will create a new file named done.tar.GZ or done.tar.Z and leave the original file untouched.

A compressed file that needs to be expanded, can be restored by using the gunzip or uncompress command. At the ROHAN prompt type:

rohan% gunzip  done.tar.GZ

or

rohan% uncompress  done.tar.Z

As with the compress program, the file done.tar.Z will be replaced by the extracted file done.tar. To leave the original file compressed and make a copy named alldone.tar, at the ROHAN prompt type:

rohan% gunzip  -c  done.tar.GZ  >  alldone.tar

or

rohan% uncompress  -c  done.tar.GZ  >  alldone.tar

Once the file has been expanded, the archive still must be extracted to re-create the directory structure of the original files. At the ROHAN prompt type:

rohan% tar  -xvf  alldone.tar

Unlike the gunzip and the uncompress programs, tar will leave the original archive untouched, so it needs to be removed when it's no longer needed.

----------------------------------------------------------------------


BACK ROHAN Help Index | Academic Computing Handouts, Manuals, and Help Files

This page last modified: December 11, 2002
Send comments/suggestions about this web page to webmaster@rohan.sdsu.edu

SDSU Faculty and Students may send questions about software on ROHAN or ROHAN UNIX problems to problems@rohan.sdsu.edu