Title: Archive Utilities
1Archive Utilities
- Learning Objectives
- To introduce different archive utilities for file
compression with their usage - To compare summarized different archive
utilities
2Archive Utilities
- Table of Content
- Compress
- gzip compression
- Zip compression (PC Compatible)
- Zip (PC pkzip Compatible)
- Unzip (PC pkunzip Compatible)
- tar archive
- No compression
- Selective restore
- With Compression
- Cpio ( selected reference )
- Summary
3Summary
Archive Restore List Usage Notes
compress uncompress Compress single file
() gzip gzip -d gzip -l Backward compatible with compress Compress (better ratio) single file
() zip (-r) unzip unzip -v DOS pkzip / Winzip compatible Compress/backup multiple files/ dir.
tar cvf tar xvf tar cvf Backup multiple files/ dir. (cf. gtar ())
cpio -ocvB cpio -icvdB cpio -icvtB Backup Multiple files/ dir. (with owners / group) For your reference only
() Not available in all systems, may need to
download, see www.gnu.org
4Compress / Uncompress
- Compression single file and available on most
systems - Compressed .z file smaller, file date preserved
- Actually compression ratio depend on data (text
file and database files usually larger) - ls -l buyer
- 22651778 Nov 16 1845 buyer.dbf
- compress buyer.dbf
- ls -l buyer
- 3603257 Nov 16 1845 buyer.dbf.Z
- uncompress buyer.dbf.Z
- ls -l buyer
- 22651778 Nov 16 1845 buyer.dbf
5 gzip Compression
- Backward compatible with compress, better
compression ratio - Available from GNU www.gnu.org
- gunzip un-compresses
- gzip h
- gzip 0.7 (5 Jan 93)
- usage gzip -cdfhLrtvV19 file ...
- -c --stdout write on standard output, keep
original files unchanged - -d --decompress decompress
- -f --force force overwrite of output file
and compress links - -h --help give this help
- -L --license display software license
- -r --recurse recurse through directories
- -t --test test compressed file integrity
- -v --verbose verbose mode
- -V --version display version number
- -1 --fast compress faster
- -9 --best compress better
- file... files to (de)compress. If none
given, use standard input.
6tar archive
tar cvf /tmp/tar2.tar a letter0 1K a secret/
0K a secret/letter1 1K a secret/letter2 1K
- Traditional archive utility backup directory
tree(s) - tar cvf /tmp/tar1.tar .
- a ./ 0K
- a ./letter0 1K
- a ./secret/ 0K
- a ./secret/letter1 1K
- a ./secret/letter2 1K
- tar xvf /tmp/tar1.tar
- Restores the directory tree
7Disks Usage Statistics
- df display free blocks and of files in each
file system - df head
- /proc (/proc ) 0 blocks
934 files - / (/dev/dsk/c0t3d0s0 ) 226544 blocks
280996 files - /dev/fd fd ) 0 blocks
0 files - /var (/dev/dsk/c0t3d0s3 ) 1480320 blocks
252851 files - /cache (/dev/dsk/c0t3d0s4 ) 308472 blocks
243243 files - /home (/dev/dsk/c0t3d0s7 ) 1408858 blocks
284098 files - /tmp (swap ) 2903968 blocks
10169 files - /var/mail(mail/mail )14054672 blocks
1097254 files - /var/spool/uucp (mail/var/spool/uucp) 3450734
blocks 350809 files - du display disk usage statistics (in number of
512k blocks) - du head -5
- 282 ./zmodem
- 14 ./gzip-0.7/msdos
- 2 ./gzip-0.7/os2
- 662 ./gzip-0.7
- 3626 ./mail
du shows disk usage of directories in 512k blocks
8User Groups (2)
- View users of a group
- ypcat group grep comp111
- comp11140000kwchiu,john
- usage groupmod -g gid -o -n name group
- Renaming a group (super-user only)
- groupmod
- usage groupmod -g gid -o -n name group
- groupmod -n cs111 comp111
- Deleting a group
- groupdel
- usage groupdel group
- groupdel cs111