Often it would be nice to make a file smaller - say, to download it faster,
or so it takes up less space on your disk. The program to do this is called
gzip (GNU zip). Here's how it works:
-
- $ cd; cp /etc/profile ./mysamplefile
This switches to your home directory and copies an arbitrarily chosen file (/etc/profile)
to your current directory, in the process renaming it mysamplefile.
This gives you a file to play with when using gzip.
-
- $ ls -l
Lists the contents of the current directory. Note the size of mysamplefile.
-
- $ gzip mysamplefile
Compresses mysamplefile.
-
- $ ls -l
Observe the results of this command: mysamplefile is now called mysamplefile.gz
. It's also a good bit smaller.
-
- $ gunzip mysamplefile.gz; ls -l
This uncompresses the file. Observe that mysamplefile has returned
to its original state. Notice that to uncompress, one uses gunzip,
not gzip.
-
- $ rm mysamplefile
Use this command to remove the file, since it was just to practice with.
John Goerzen / Ossama Othman