Compression and Archival

gzip

Gzip, short for GNU zip, is a software application used for compressing files, thereby saving disk space.

Command Effect
gzip foo Encode the file foo and replaces it with the compressed file foo.gz
gzip -d foo.gz Decodes the gzip file foo.gz and replaces it with the decompressed file foo

Gzip is suitable for most applications. For more compression, bzip2 (discussed below) may be more suitable.

bzip2

Bzip2 is a software application that compresses most files more effectively than gzip but is slower.

Command Effect
bzip2 foo Encodes file foo and replaces it with the compressed file foo.bz2
bunzip2 foo.bz2

Decodes the bzip2 file foo.bz2 and replaces it with the decompressed file foo.

tar

Tar, derived from tape archive, is a software application for archiving files and directories. Tar is also capable of compressing files using gzip or bzip2.

Command Effect
tar -cvfz foo.tgz dir-name Creates an archive with the contents of the dir-name directory, then compresses the archive into the file foo.tgz. (The options c,v,f and z stand for "create", "verbose" (list the files being archived to the console), "file name follows" (the archive name is the next argument), and "zip" respectively)
tar -xvfz foo.tgz Decompresses the archive foo.tgz, then extracts the archived files and directories. (The options x, v, f and z stand for "extract", "verbose" (list the files being extracted to the console), "file name follows" (the archive name is the next argument) and "unzip" respectively)

It is recommended that you "tar up" any files/directories that you will not be using for an extended period of time in order to save quota space.