next up previous
Next: Changing the Permissions on Up: USING UNIX Previous: Searching For and Inside

Compressing and Encrypting Files (gzip, gunzip, zcat, crypt)

You can reduce the storage space needed for a file by compressing it. The command is gzip filename. This takes the named file, compresses it and then puts the result in a file called filename.gz. To uncompress it you use gunzip filename.gz. You can look at a compressed file without uncompressing it via zcat filename.gz | more (the vertical bar | is called a pipe and will be discussed below).

You encrypt a file using something similar to :
crypt key < clear.file > encrypted.file
This takes the contents of the file named clear.file, encrypts it, and puts the result in the file named encrypted.file. (The > and < are redirects and will be discussed below.) The word you use in place of key is the key needed to decrypt the file, so remember it! When you use crypt, it does not remove the file clear.file. If you want to remove it, you use the standard rm clear.file. To decrypt the file you use:
crypt key < encrypted.file > clear.file
Where in place of key you use the same key word you used to encrypt the file.