[Chapter 19] Creating and Reading Archives

UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 18.16 Copying Directory Trees with (tar | tar) Chapter 19Next: 19.2 Introduction to Shell Archives
 

19. Creating and Reading Archives

Contents:
Packing Up and Moving
Introduction to Shell Archives
unshar: Unarchive a Shell Archive
A Simple Version of unshar
Using tar to Create and Unpack Archives
GNU tar Sampler
Extracting Files from a Compressed Archive
Problems with Verbose tar
A System V Tape Archiver: cpio

19.1 Packing Up and Moving

The worst part of living in a nice big house is the headache of moving. The more stuff you've got room for, the more trouble it is to pack it up and take it with you.

The UNIX operating system is a little bit like that. One of its real advantages is a filesystem that lets you organize your personal files into a hierarchical directory tree just like the much bigger tree that encompasses the entire filesystem. You can squirrel away all kinds of useful information into neat pigeonholes.

While your personal directory hierarchy is usually only two or three levels deep, for all practical purposes it can have as many levels as you like. And, as is true of any powerful and flexible tool, problems lie in wait for the sorcerer's apprentice. Directories and files grow increasingly complex the longer you use the system, with more forgotten files and more detailed organization.

This chapter will tackle the problems that can arise when you want to move a block of files (in one or many directories) from one place to another.

Maybe you're writing the files to a tape for safety (20.2). In many cases though, this is a "backup and restore" problem. For example, if you were moving your account to another system, you might just ask the system administrator (if there is one) to archive your files to tape or floppy and restore them in the new location. Many new users are less aware that you can use the backup programs tar (20.1) and cpio (19.9) (as well as some common archive programs like shar (19.2)) to create online archives that you can move from one place to another.

This situation is most likely to arise in a networked environment. You might be packaging files to ship as a package to another user. The files might be going to Usenet or an archive site on the Internet, for distribution to many users. Even though we've made a conscious decision (1.32) to omit networking information from this book these programs are so useful even on a single system (let alone one without the artificial boundaries we've put on this book) that we decided we ought to keep this chapter in the book.

- TOR


Previous: 18.16 Copying Directory Trees with (tar | tar) UNIX Power ToolsNext: 19.2 Introduction to Shell Archives
18.16 Copying Directory Trees with (tar | tar) Book Index19.2 Introduction to Shell Archives

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System