Chapter 11 Study Guide
Compression, System Backup, and Software Installation
Compression
Compression is the process in which files are reduced in size by a compression algorithm. The standard set of instructions used to compress a file is the compression algorithm. To decompress a file, you run compression algorithm in reverse. Compression ratios are known as the different rates of compression, which vary among the different compression algorithms. The compression utilities discussed in this chapter are:
Compress Gzip Bzip2
Compress
- Uses Adaptive Lempel-Ziv coding(LWZ) as its compression algorithm.
- Average compression ratio of 40 to 50 percent.
- Compressed files are renamed with a .Z filename extension to indicate that it is compressed.
- Symbolic links are no compressed unless the -f option is given.
Useful commands
compress uncompress zcat zmore zless
Common options used with the compress utility
-c Used with uncompress, it displays the contents of the compressed file to SO -f Used with compress, used to compress symbolic links. Used with uncompress, overwrites existing files without prompting user. -r Specifies to compress or decompress all files recursively within a directory. -v Displays verbose output during compression and decompression.
Gzip
- GNU zip(gzip).
- Uses Limpel-Ziv(LZ77) compression algorithm.
- Average compression ratio is 60 to 70 percent.
- Symbolic links are no compressed unless the -f option is given.
- Compressed files use the .gz filename extension.
- Ability to control the compression ratio using numeric values 1-9. 1 gives you faster compression time and yields lower ratio, 9 gives you slowest compression time and yields higher ratio.
- Default compression number is 6.
Useful commands
gzip gunzip
Common options used with the gzip utility
-# Specifies how thorough the compression will be. # can be any numeric value from 1 to 9. If no value, Default is 6. --best Results in higher compression ratio; same as the -9 option. -c --stdout -to-stdout Displays the contents of the compress file to SO. -d --decompress --uncompress Decompresses the files specified when used with the gzip command. -f --force Compresses symbolic links, or overwrites any existing files without prompting user. --fast Results in a lower compression ratio; same as the -1 option. -h --help Displays the syntax and available options for the gzip and gunzip commands. -l --list Lists the compression ratio for files that have been compressed with gzip. -n --no-name Does not allow gzip and gunzip to preserve the original modification and access time for fiels. -q --quite Supresses all warning messages. -r --recursive Specifies to compress or decompress all files recursively within a directory. -S .suffix --suffix .suffix Specifies a file suffix other than .gz. -t --test Performs a test decompression so the user can view any error messages before decompression. -v --verbose Displays verbose output(compression ratio and filenames).
Bzip2
- Uses Burrows-Wheeler Block Sorting Huffman Coding compression algorithm.
- Cannot be used to compress a directory full of files.
- Compression ratio is 50 to 75 percent.
- Symbolic links are only compressed if the -f option is used.
- Compressed files are renamed with .bz2 filename extension.
- to decompress files, use the bunzip2 command followed by the filename to decompress.
Useful commands
bzip2 bzcat bzmore bzless bunzip2
Common options used with the bzip2 utility
-# Specifies the block size used during compression; -1 = block size of 100K, -9 = block size of 900K. -c --stdout Displays the contents of the compressed file to SO. -d --decompress Decompresses the files specified, same as bunzip2 command. -f --force Compresses symbolic links, or overwrites any existing files without prompting the user. -k --keep Keeps the original file during compression; a new file is created with the extension .bz2. -q --quite Suppresses all warning messages. -s -small Minimizes memory usage during compression. -t --test Performs a test decompression so a user can view any error messages before decompression. -v --verbose Displays verbose output(compression ratio).
System Backup
A system backup is the process of creating backup copies of files and directories regularly and storing them at an alternate location. These copies can be distributed to other computers, or use them to restore files lost as a result of a system failure. The backup copies of files and directories are called archives. An incremental backup backs up only the data that has been changed since the last backup(full or incremental).
- tar
- cpio
- dump/restore
- Disk-burning software
The tar Utility
- Tape Archive(tar).
- One of the oldest widely used backup utilities.
- Can create an archive in a file or directly on a device.
- Files are backed up recursively and stored using relative pathnames.
Useful commands
tar
Refer to page 487 for a table of common options used with the tar utility.
The cpio Utility
- copy in/out(cpio).
- Ability to use long filenames and back up device files.
- Uses absolute pathnames by default.
Useful commands
cpio find
Refer to page 491 for a table of common options used with the cpio utility.
The dump/restore Utility
- Can only work with files on ext2 and ext3 filesystems.
- Nine different incremental backups; 0 = a full backup, 1 through 9 - incremental backups. The lower the number the more data backed up.
Useful commands
df dump restore
Refer to page 494 for a table of common options used with the dump/restore utility.
Software Installation
A checksum is a calculated value that is unique to a file's size and contents, and is used to verify the file has been downloaded in its entirety. A Package Manager is a system that defines a standard package format and can be used to install, query, and remove packages. The most commonly used package manager in linux is the Red Hat Package Manager(RPM).
Installing Programs Using RPM
Be sure to understand the concept of using the yum command to search the internet and finding packages to be downloaded and installed on your system.
Refer to page 508 for a table of common options used with the rpm utility.
Useful commands
rpm yum