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:

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.

Debian GNU/Linux : Guide to Installation and Usage — Part 62

Lists the contents of the current directory. Note the size of mysamplefile.

Debian GNU/Linux : Guide to Installation and Usage — Part 62

Observe the results of this command: mysamplefile is now called mysamplefile.gz . It’s also a good bit smaller.

Debian GNU/Linux : Guide to Installation and Usage — Part 62

This uncompresses the file. Observe that mysamplefile has returned to its original state. Notice that to uncompress, one uses gunzip, not gzip.

Use this command to remove the file, since it was just to practice with.

There are two different facilities for finding files: find and locate. find searches the actual files in their present state. locate searches an index generated by the system every morning at 6:42 a.m. (this is a cron job, explained elsewhere in this book). locate won’t find any files that were created after the index was generated. However, because locate searches an index, it’s much faster—like using the index of a book rather than looking through the whole thing.

To compare the two ways of finding files, pretend you can’t remember where the X configuration file XF86Config resides.

This should be pretty fast. You’ll get a list of filenames that contain XF86Config, something like this:

/etc/X11/XF86Config / /usr/X11R6/lib/X11/XF86Config / /usr/X11R6/lib/X11/XF86Config.eg / /usr/X11R6/man/man5/XF86Config.5x.gz / / / / Now try the find command:

You will hear a lot of disk activity, and this will take a lot longer. Results will look something like this:

/etc/X11/XF86Config / /usr/X11R6/lib/X11/XF86Config / find: /var/spool/cron/atjobs: Permission denied find: /var/spool/cron/atspool: Permission denied find: /var/lib/xdm/authdir: Permission denied

Notice that find found only files that were named _exactly_ XF86Config, rather than any files containing that string of letters. Also, find actually tried to look in every directory on the system—including some where you didn’t have read permissions. That’s why you got the Permission denied messages.