Archiving and Compressing Files

Now that you know all about files, permissions, and the errors that you might get, you need to master tar and gzip.

Start with gzip (GNU Zip), the current standard Unix compression program. A file that ends with .gz is a GNU Zip archive. Use gunzip file.gz to uncompress file.gz and remove the suffix; to compress it again, use gzip file.

gzip does not perform the additional function of archiving, like the ZIP programs for other operating systems — that is, it does not pack multiple files and directories into one file, thus creating an archive. To create an archive, use tar instead:

tar cvf archive.tar file1 file2 ...

tar archives have a .tar suffix. In the preceding example, file1, file2, and so on are the names of ...

Get How Linux Works now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.