📄 ch19_01.htm
字号:
<HTML><!--Distributed by F --><HEAD><TITLE>[Chapter 19] Creating and Reading Archives</TITLE><METANAME="DC.title"CONTENT="UNIX Power Tools"><METANAME="DC.creator"CONTENT="Jerry Peek, Tim O'Reilly & Mike Loukides"><METANAME="DC.publisher"CONTENT="O'Reilly & Associates, Inc."><METANAME="DC.date"CONTENT="1998-08-04T21:39:20Z"><METANAME="DC.type"CONTENT="Text.Monograph"><METANAME="DC.format"CONTENT="text/html"SCHEME="MIME"><METANAME="DC.source"CONTENT="1-56592-260-3"SCHEME="ISBN"><METANAME="DC.language"CONTENT="en-US"><METANAME="generator"CONTENT="Jade 1.1/O'Reilly DocBook 3.0 to HTML 4.0"><LINKREV="made"HREF="mailto:online-books@oreilly.com"TITLE="Online Books Comments"><LINKREL="up"HREF="part03.htm"TITLE="III. Working with the Filesystem "><LINKREL="prev"HREF="ch18_16.htm"TITLE="18.16 Copying Directory Trees with (tar | tar) "><LINKREL="next"HREF="ch19_02.htm"TITLE="19.2 Introduction to Shell Archives "></HEAD><BODYBGCOLOR="#FFFFFF"TEXT="#000000"><DIVCLASS="htmlnav"><H1><IMGSRC="gifs/smbanner.gif"ALT="UNIX Power Tools"USEMAP="#srchmap"BORDER="0"></H1><MAPNAME="srchmap"><AREASHAPE="RECT"COORDS="0,0,466,58"HREF="index.htm"ALT="UNIX Power Tools"><AREASHAPE="RECT"COORDS="467,0,514,18"HREF="jobjects/fsearch.htm"ALT="Search this book"></MAP><TABLEWIDTH="515"BORDER="0"CELLSPACING="0"CELLPADDING="0"><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch18_16.htm"TITLE="18.16 Copying Directory Trees with (tar | tar) "><IMGSRC="gifs/txtpreva.gif"SRC="gifs/txtpreva.gif"ALT="Previous: 18.16 Copying Directory Trees with (tar | tar) "BORDER="0"></A></TD><TDALIGN="CENTER"VALIGN="TOP"WIDTH="171"><B><FONTFACE="ARIEL,HELVETICA,HELV,SANSERIF"SIZE="-1">Chapter 19</FONT></B></TD><TDALIGN="RIGHT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch19_02.htm"TITLE="19.2 Introduction to Shell Archives "><IMGSRC="gifs/txtnexta.gif"SRC="gifs/txtnexta.gif"ALT="Next: 19.2 Introduction to Shell Archives "BORDER="0"></A></TD></TR></TABLE> <HRALIGN="LEFT"WIDTH="515"TITLE="footer"></DIV><DIVCLASS="CHAPTER"><H1CLASS="chapter"><ACLASS="title"NAME="UPT-CHP-19">19. Creating and Reading Archives</A></H1><DIVCLASS="htmltoc"><P><B>Contents:</B><BR><ACLASS="sect1"HREF="#UPT-ART-5080"TITLE="19.1 Packing Up and Moving ">Packing Up and Moving </A><BR><ACLASS="sect1"HREF="ch19_02.htm"TITLE="19.2 Introduction to Shell Archives ">Introduction to Shell Archives </A><BR><ACLASS="sect1"HREF="ch19_03.htm"TITLE="19.3 unshar: Unarchive a Shell Archive ">unshar: Unarchive a Shell Archive </A><BR><ACLASS="sect1"HREF="ch19_04.htm"TITLE="19.4 A Simple Version of unshar ">A Simple Version of unshar </A><BR><ACLASS="sect1"HREF="ch19_05.htm"TITLE="19.5 Using tar to Create and Unpack Archives ">Using tar to Create and Unpack Archives </A><BR><ACLASS="sect1"HREF="ch19_06.htm"TITLE="19.6 GNU tar Sampler ">GNU tar Sampler </A><BR><ACLASS="sect1"HREF="ch19_07.htm"TITLE="19.7 Extracting Files from a Compressed Archive ">Extracting Files from a Compressed Archive </A><BR><ACLASS="sect1"HREF="ch19_08.htm"TITLE="19.8 Problems with Verbose tar ">Problems with Verbose tar </A><BR><ACLASS="sect1"HREF="ch19_09.htm"TITLE="19.9 A System V Tape Archiver: cpio ">A System V Tape Archiver: cpio </A></P><P></P></DIV><DIVCLASS="sect1"><H2CLASS="sect1"><ACLASS="title"NAME="UPT-ART-5080">19.1 Packing Up and Moving </A></H2><PCLASS="para"><ACLASS="indexterm"NAME="UPT-ART-5080-IX-ARCHIVES"></A>The worst part of living in a nice big house isthe headache of moving.The more stuffyou've got room for, the more trouble it isto pack it up and take it with you.</P><PCLASS="para">The UNIX operating system is a little bit like that.One of its real advantages is a filesystem thatlets you organize your personal files into a hierarchical directory tree justlike the much bigger treethat encompasses the entire filesystem.You cansquirrel away all kinds of useful information intoneat pigeonholes.</P><PCLASS="para">While your personal directory hierarchy isusually only two or three levels deep, for all practical purposes it canhave 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 thelonger you use the system, with more forgotten filesand more detailed organization.</P><PCLASS="para">This chapter will tackle theproblems that can arise when you wantto move a block of files (in one or many directories)from one place to another.</P><PCLASS="para">Maybe you're<SPANCLASS="link">writing the files to a tape for safety (<ACLASS="linkend"HREF="ch20_02.htm"TITLE="Make Your Own Backups ">20.2</A>)</SPAN>.In many cases though, this is a "backup and restore"problem.For example, if you were moving youraccount to another system, you might just ask thesystem administrator (if there is one) to archive your filesto tape or floppy and restore them in the new location.Many new users are less aware that you canuse the backup programs<SPANCLASS="link"><EMCLASS="emphasis">tar</EM> (<ACLASS="linkend"HREF="ch20_01.htm#UPT-ART-8024"TITLE="tar in a Nutshell ">20.1</A>)</SPAN>and<SPANCLASS="link"><EMCLASS="emphasis">cpio</EM> (<ACLASS="linkend"HREF="ch19_09.htm"TITLE="A System V Tape Archiver: cpio ">19.9</A>)</SPAN>(as well assome common archive programs like <SPANCLASS="link"><EMCLASS="emphasis">shar</EM> (<ACLASS="linkend"HREF="ch19_02.htm"TITLE="Introduction to Shell Archives ">19.2</A>)</SPAN>)to create online archives that you can move from oneplace to another.</P><PCLASS="para"><ACLASS="indexterm"NAME="AUTOID-21203"></A>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 anarchive site on the Internet, for distribution to many users.Even though we've made a <SPANCLASS="link">conscious decision (<ACLASS="linkend"HREF="ch01_32.htm"TITLE="One Big Hole ">1.32</A>)</SPAN>to omit networking information from this bookthese programs are so useful even on a single system(letalone one without the artificial boundaries we've put on thisbook) that we decided we ought to keep this chapter in thebook.<ACLASS="indexterm"NAME="AUTOID-21207"></A></P><DIVCLASS="sect1info"><PCLASS="SECT1INFO">- <SPANCLASS="authorinitials">TOR</SPAN></P></DIV></DIV></DIV><DIVCLASS="htmlnav"><P></P><HRALIGN="LEFT"WIDTH="515"TITLE="footer"><TABLEWIDTH="515"BORDER="0"CELLSPACING="0"CELLPADDING="0"><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch18_16.htm"TITLE="18.16 Copying Directory Trees with (tar | tar) "><IMGSRC="gifs/txtpreva.gif"SRC="gifs/txtpreva.gif"ALT="Previous: 18.16 Copying Directory Trees with (tar | tar) "BORDER="0"></A></TD><TDALIGN="CENTER"VALIGN="TOP"WIDTH="171"><ACLASS="book"HREF="index.htm"TITLE="UNIX Power Tools"><IMGSRC="gifs/txthome.gif"SRC="gifs/txthome.gif"ALT="UNIX Power Tools"BORDER="0"></A></TD><TDALIGN="RIGHT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch19_02.htm"TITLE="19.2 Introduction to Shell Archives "><IMGSRC="gifs/txtnexta.gif"SRC="gifs/txtnexta.gif"ALT="Next: 19.2 Introduction to Shell Archives "BORDER="0"></A></TD></TR><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="172">18.16 Copying Directory Trees with (tar | tar) </TD><TDALIGN="CENTER"VALIGN="TOP"WIDTH="171"><ACLASS="index"HREF="index/idx_0.htm"TITLE="Book Index"><IMGSRC="gifs/index.gif"SRC="gifs/index.gif"ALT="Book Index"BORDER="0"></A></TD><TDALIGN="RIGHT"VALIGN="TOP"WIDTH="172">19.2 Introduction to Shell Archives </TD></TR></TABLE><HRALIGN="LEFT"WIDTH="515"TITLE="footer"><IMGSRC="gifs/smnavbar.gif"SRC="gifs/smnavbar.gif"USEMAP="#map"BORDER="0"ALT="The UNIX CD Bookshelf Navigation"><MAPNAME="map"><AREASHAPE="RECT"COORDS="0,0,73,21"HREF="../index.htm"ALT="The UNIX CD Bookshelf"><AREASHAPE="RECT"COORDS="74,0,163,21"HREF="index.htm"ALT="UNIX Power Tools"><AREASHAPE="RECT"COORDS="164,0,257,21"HREF="../unixnut/index.htm"ALT="UNIX in a Nutshell"><AREASHAPE="RECT"COORDS="258,0,321,21"HREF="../vi/index.htm"ALT="Learning the vi Editor"><AREASHAPE="RECT"COORDS="322,0,378,21"HREF="../sedawk/index.htm"ALT="sed & awk"><AREASHAPE="RECT"COORDS="379,0,438,21"HREF="../ksh/index.htm"ALT="Learning the Korn Shell"><AREASHAPE="RECT"COORDS="439,0,514,21"HREF="../lrnunix/index.htm"ALT="Learning the UNIX Operating System"></MAP></DIV></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -