How can I archive or compress files on Athena?
On this page:
Overview
The two most popular archive formats in use are gzipped tar files (.tar.gz or .tgz) and zip files (.zip). While there are many other formats, these formats are the most popular and can be read on the widest variety of operating systems.
Zip files can be decompressed automatically by Windows XP and higher, and Mac OS X. .tar.gz files can be decompressed automatically on Mac OS X, but Windows users will require additional software such as the free 7-Zip (http://www.7-zip.org) or a trial version of WinZip (www.winzip.com).
ZIP files
You can create .zip files with the "zip" command. For example, to create "archive.zip" containing the files "1.txt", "2.txt", and "3.txt" (assuming they are in the current directory), you would use the following command:
adding: 1.txt (deflated 54%) adding: 2.txt (deflated 83%) adding: 3.txt (deflated 26%)
Alternatively, if you want to create a zip file of your personal web site, you can use:
That will compress the www directory and all its contents into the website.zip file. If you omit the "-r" option to zip, you will end up with an empty ZIP file, since it will add the entry for the directory, but none of its contents.
ZIP files can be uncompressed with the "unzip" command. Simply typing "unzip filename.zip" will usually produce the desired behavior, which is to extract the file into the current directory.
For more information, type "man zip" and "man unzip"
tar.gz files
Creating tar.gz files is actually a two step process - first you are creating a tar (which stands for "Tape ARchive") file, and then you are compressing it.
To create a tar file of your "www" directory:
The -cvf options to tar instruct it to create an archive (c), be verbose by displaying every filename as it's added (v), and that you wish the archive to be saved to a file (f) called archive.tar.
Once the .tar file has been created, you can compress it with "gzip":
This will change the filename to "archive.tar.gz" and compress the file.
The GNU version of tar (found on Linux systems and most other modern UNIX operating systems) can do the gzip compression automatically, by adding "z" to the list of tar options:
However, not all versions of tar support the GNU extensions, so you may need to use the two-step procedure described above.
To extract .tar.gz files into the current directory, you first decompress the archive with the "gunzip" command, and then extract it:
joeuser@athena:~$ tar -xvf archive.tar
Once again, GNU tar users can combine this into one step:
Other archive formats
It may be possible to create and extract other archive formats on Athena, but the formats listed above are the only supported ones. The following table lists additional formats that we're aware of, but we cannot guarantee that they will work:
Format | Extension | Compression Program | Extraction Program |
---|---|---|---|
Compress | .Z | compress | uncompress |
Frozen | .F | freeze (sipb locker) | melt (sipb locker) |
BinHex | .hqx | (n/a) | xbin (consult locker) |
Roshal Archive | .rar | (n/a) | unrar (outland locker) |