Managing Disk Space   «Prev  Next»
Lesson 9

Managing Disk Space Conclusion

This module was about managing disk space. You learned how to use the du command to display disk usage for files and directories. This module also covered three related commands:
  1. compress,
  2. uncompress, and
  3. zcat
for managing file compression. In the last half of the module, you learned how to use the tar command when working with archives. You created an archive, listed the archive files, and extracted them.

How is the zcat command used in unix?

The zcat command in Unix is used to view the contents of a compressed file, such as a file that has been compressed using gzip or similar compression tools. The zcat command is essentially equivalent to using cat on an uncompressed file.
Here is the basic syntax for the zcat command:
zcat [OPTIONS] [COMPRESSED_FILE]

Here are some common options for the zcat command:
  1. -h or --help: display help information
  2. -f or --force: force the decompression of a file, even if it does not have the correct file extension
  3. -q or --quiet: suppress informational messages

Here are some examples of how to use the zcat command:
  1. To view the contents of a compressed file:
    zcat file.gz
    
  2. To view the contents of a compressed file in a pager such as less:
    zcat file.gz | less
    
  3. To force the decompression of a file with an unknown file extension:
    zcat -f unknownfile.xyz
    
  4. To view the contents of a compressed file without informational messages:
    zcat -q file.gz
    
The zcat command can be used in combination with other Unix commands to analyze, process or manipulate compressed files. For example, piping the output of zcat to the grep command can be used to search for specific patterns within compressed files.

Key commands used in Unix for compression

This module introduced the following key UNIX commands:
  1. du
  2. compress
  3. uncompress
  4. zcat
  5. tar

Glossary

This module introduced you to the following terms and concepts:
  1. archive: An archive is a set of files that are packaged as a single, large file.
  2. block: A block is a unit of storage equal to 512 bytes.
  3. extract: To extract files from an archive means to copy them out of an archive and onto the filesystem.
  4. disk usage: Disk usage is the amount of storage space your files occupy on the disk.
  5. file compression: File compression is a way of packing a file\'s contents more efficiently, so that the file takes up less disk space.
  6. tape device: A tape device is any hardware that contains a tape drive for use with storage media.
  7. tar file: A tar file is an archive created by the tar command.
  8. verbose: When a command uses verbose mode, the command displays more than the usual status information. Many UNIX commands accept a -v option that causes them to run in verbose mode.
  9. .Z extension: When you run the compress command, the resulting files are renamed to end with a .Z extension

In the next module you will learn how to use File Transfer Protocol to send and retrieve files.

Unix Archiving - Quiz

Click the Quiz link to test what you learned in this module.
Unix Archiving - Quiz