⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ch20_07.htm

📁 the unix power tools
💻 HTM
字号:
<HTML><!--Distributed by F --><HEAD><TITLE>[Chapter 20] 20.7 Creating a Timestamp File for Selective Backups </TITLE><METANAME="DC.title"CONTENT="UNIX Power Tools"><METANAME="DC.creator"CONTENT="Jerry Peek, Tim O'Reilly &amp; Mike Loukides"><METANAME="DC.publisher"CONTENT="O'Reilly &amp; Associates, Inc."><METANAME="DC.date"CONTENT="1998-10-23T15:44:57Z"><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="ch20_01.htm"TITLE="20. Backing Up Files"><LINKREL="prev"HREF="ch20_06.htm"TITLE="20.6 Writing a Tape Drive on a Remote Machine "><LINKREL="next"HREF="ch20_08.htm"TITLE="20.8 Telling tar Which Files to Exclude or Include "></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="ch20_06.htm"TITLE="20.6 Writing a Tape Drive on a Remote Machine "><IMGSRC="gifs/txtpreva.gif"SRC="gifs/txtpreva.gif"ALT="Previous: 20.6 Writing a Tape Drive on a Remote Machine "BORDER="0"></A></TD><TDALIGN="CENTER"VALIGN="TOP"WIDTH="171"><B><FONTFACE="ARIEL,HELVETICA,HELV,SANSERIF"SIZE="-1">Chapter 20<BR>Backing Up Files</FONT></B></TD><TDALIGN="RIGHT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch20_08.htm"TITLE="20.8 Telling tar Which Files to Exclude or Include "><IMGSRC="gifs/txtnexta.gif"SRC="gifs/txtnexta.gif"ALT="Next: 20.8 Telling tar Which Files to Exclude or Include "BORDER="0"></A></TD></TR></TABLE>&nbsp;<HRALIGN="LEFT"WIDTH="515"TITLE="footer"></DIV><DIVCLASS="SECT1"><H2CLASS="sect1"><ACLASS="title"NAME="UPT-ART-7941">20.7 Creating a Timestamp File for Selective Backups </A></H2><PCLASS="para"><ACLASS="indexterm"NAME="AUTOID-22249"></A><ACLASS="indexterm"NAME="AUTOID-22252"></A>Whenever I upgraded to a new version of UNIX, one commonproblem was making sure I maintained all of the changesmade to the standard release of UNIX.Previously, I did an<SPANCLASS="link"><EMCLASS="emphasis">ls -lt</EM> (<ACLASS="linkend"HREF="ch16_02.htm"TITLE="Finding Oldest or Newest Files with ls -t and ls -u ">16.2</A>)</SPAN>in each directory, and then I examined the modification date.The files that were changed have an obviously newer date than theoriginal programs [unless the changed files come from a <EMCLASS="emphasis">tar</EM>archive, with their original modification dates preserved! -<EMCLASS="emphasis">JP</EM>&nbsp;]Even so, finding every change was tedious, as therewere dozens of directories to be searched.</P><PCLASS="para">A better solution is to create a file as the first step in upgrading.I usually call this<EMCLASS="emphasis">FirstFile</EM>.<EMCLASS="emphasis">find</EM>has a<ACLASS="indexterm"NAME="AUTOID-22262"></A><SPANCLASS="link"><EMCLASS="emphasis">-newer</EM> option (<ACLASS="linkend"HREF="ch17_08.htm"TITLE="Exact File Time Comparisons ">17.8</A>)</SPAN>that tests each file and compares the modification date to thenewer file. If you then wanted to list all files in<EMCLASS="emphasis">/usr</EM>that need to be saved when the operating system is upgraded, use:</P><PCLASS="para"><BLOCKQUOTECLASS="screen"><PRECLASS="screen">% <CODECLASS="userinput"><B>find /usr -newer /usr/FirstFile -print</B></CODE></PRE></BLOCKQUOTE></P><PCLASS="para">This could then be used to create a<SPANCLASS="link"><EMCLASS="emphasis">tar</EM> (<ACLASS="linkend"HREF="ch19_05.htm"TITLE="Using tar to Create and Unpack Archives ">19.5</A>)</SPAN>or<SPANCLASS="link"><EMCLASS="emphasis">cpio</EM> (<ACLASS="linkend"HREF="ch19_09.htm"TITLE="A System V Tape Archiver: cpio ">19.9</A>)</SPAN>file that would be restored after the upgrade.</P><DIVCLASS="sect1info"><PCLASS="SECT1INFO">- <SPANCLASS="authorinitials">BB</SPAN></P></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="ch20_06.htm"TITLE="20.6 Writing a Tape Drive on a Remote Machine "><IMGSRC="gifs/txtpreva.gif"SRC="gifs/txtpreva.gif"ALT="Previous: 20.6 Writing a Tape Drive on a Remote Machine "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="ch20_08.htm"TITLE="20.8 Telling tar Which Files to Exclude or Include "><IMGSRC="gifs/txtnexta.gif"SRC="gifs/txtnexta.gif"ALT="Next: 20.8 Telling tar Which Files to Exclude or Include "BORDER="0"></A></TD></TR><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="172">20.6 Writing a Tape Drive on a Remote Machine </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">20.8 Telling tar Which Files to Exclude or Include </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 &amp; 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 + -