2. Objectives
Outline the features of common
compression utilities
Compress and decompress files using
common compression utilities
Perform system backups using the tar,
cpio, and dump commands
View and extract archives using the
tar, cpio, and restore commands
2
3. Compression
Compression: process in which files are
reduced in size by stripping out
characters
Compression algorithm: standard set of
instructions used to compress a file
Compression ratio: percentage by which
the file size was decreased
Common compression utilities include
compress, gzip, and bzip2
3
4. The compress Utility
Use to compress files using the Adaptive
Lempel Ziv coding (LZW) compression
algorithm
Average compression ratio of 40-50%
compress command: used to compress files
zcat command: used to display the contents
of an archive created with compress
Can use zmore and zless commands to view
contents page-by-page
uncompress command: used to decompress
files compressed by compress command
4
5. The gzip Utility
GNU zip (gzip): used to compress files
using the Lempel-Ziv compression
algorithm (LZ77)
Varies slightly from algorithm used by
compress
Average compression ratio of 60-70%
Uses .gz filename extension by default
gunzip command: used to decompress
.gz files
5
6. The bzip2 Utility
bzip2 command: used to compress files
using Burrows-Wheeler Block Sorting
Huffman Coding compression algorithm
Cannot compress directory full of files
Cannot use zcat and zmore to view files
○ Must use bzcat command
Compression ratio is 50% to 75% on average
Uses .bz2 filename extension by default
bunzip2 command: used to decompress
files compressed via bzip2
6
7. System Backup
System backup: process whereby files are
copied to an archive
Archive: location (file or device) that
contains copy of files
Typically created by a backup utility
Should backup user files from home
directories and any important system
configuration files
Possibly files used by system services as well
Several backup utilities available
tar, cpio, dump/restore, burning software
Linux+ Guide to Linux Certification, 3e 7
9. The tar Utility
Tape archive (tar) utility: one of oldest
and most common backup utilities
Can create archive in a file on a filesystem
or directly on a device
tar command: activates tar utility
Arguments list the files to place in the
archive
Accepts options to determine location of
archive and action to perform on archive
Linux+ Guide to Linux Certification, 3e 9
10. The tar Utility (continued)
Linux+ Guide to Linux Certification, 3e 10
-x Extract Archive
-c Create New Archive
-r Append to Archive
-v verbose
-f Write/Read File
-t List Archive Contents
-z Compress using gzip (c mode only)
11. The tar Utility (continued)
tar utility does not compress files inside
archive
Time needed to transfer archive across a
network is high
Can compress archive
Backing up files to compressed archive on
a filesystem is useful when transferring
data across a network
Use options of the tar command to compress
an archive immediately after creation
Linux+ Guide to Linux Certification, 3e 11
12. The cpio Utility
Copy in/out (cpio): common backup
utility
Activated by the cpio command
○ Has various options
Includes options similar to tar utility
Has added features
○ Ability to back up device files
○ Long filenames
Uses absolute pathnames by default when
archiving
Linux+ Guide to Linux Certification, 3e 12
13. The dump/restore Utility
dump/restore: Used to back up files and
directories to device or file on filesystem
Works only with files on ext2 and ext3
filesystems
Designed to backup entire filesystems to
an archive
/etc/dumpdates: file used to store
information about incremental and full
backups
Linux+ Guide to Linux Certification, 3e 13
14. The dump/restore Utility
(continued)
Full backup: archiving all data on
filesystem
Incremental backup: backs up only data
that has changed since last backup
Can perform up to nine different incremental
backups
dump command: create archives for full
or incremental backup
restore command: extract archives
created with dump
Linux+ Guide to Linux Certification, 3e 14
15. Summary
Many compression utilities are available for
Linux systems; each uses a different
compression algorithm and produces a
different compression ratio
Files can be backed up to an archive using
a
backup utility
To back up files to CD-RW or DVD-RW, use
burning software instead of a backup utility
Linux+ Guide to Linux Certification, 3e 15
16. Summary (continued)
tar is the most common backup utility
used today
Typically used to create compressed
archives called tarballs
Linux+ Guide to Linux Certification, 3e 16