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

📄 ch21_04.htm

📁 the unix power tools
💻 HTM
字号:
<HTML><!--Distributed by F --><HEAD><TITLE>[Chapter 21] 21.4 Why Both /tmp and /usr/tmp? </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-08-04T21:40:03Z"><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="ch21_01.htm"TITLE="21. More About Managing Files"><LINKREL="prev"HREF="ch21_03.htm"TITLE="21.3 Unique Names for Temporary Files "><LINKREL="next"HREF="ch21_05.htm"TITLE="21.5 What Good Is a File's Last Access Time? "></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="ch21_03.htm"TITLE="21.3 Unique Names for Temporary Files "><IMGSRC="gifs/txtpreva.gif"SRC="gifs/txtpreva.gif"ALT="Previous: 21.3 Unique Names for Temporary Files "BORDER="0"></A></TD><TDALIGN="CENTER"VALIGN="TOP"WIDTH="171"><B><FONTFACE="ARIEL,HELVETICA,HELV,SANSERIF"SIZE="-1">Chapter 21<BR>More About Managing Files</FONT></B></TD><TDALIGN="RIGHT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch21_05.htm"TITLE="21.5 What Good Is a File's Last Access Time? "><IMGSRC="gifs/txtnexta.gif"SRC="gifs/txtnexta.gif"ALT="Next: 21.5 What Good Is a File's Last Access Time? "BORDER="0"></A></TD></TR></TABLE>&nbsp;<HRALIGN="LEFT"WIDTH="515"TITLE="footer"></DIV><DIVCLASS="SECT1"><H2CLASS="sect1"><ACLASS="title"NAME="UPT-ART-0097">21.4 Why Both /tmp and /usr/tmp? </A></H2><PCLASS="para">[UNIX traditionally has two places to put temporary files: <ICLASS="filename">/tmp</I>and <ICLASS="filename">/usr/tmp</I>.This article explains how that started. -JP]</P><PCLASS="para"><ACLASS="indexterm"NAME="AUTOID-23075"></A><ACLASS="indexterm"NAME="AUTOID-23079"></A><ACLASS="indexterm"NAME="AUTOID-23081"></A>As I understand it, the reason for the <EMCLASS="emphasis">/tmp</EM>-<EMCLASS="emphasis">/usr/tmp</EM>split is identical to the reason for the <EMCLASS="emphasis">/bin</EM>-<EMCLASS="emphasis">/usr/bin</EM> and<EMCLASS="emphasis">/lib</EM>-<EMCLASS="emphasis">/usr/lib</EM>splits and is a historical accident of hardware configuration at theResearch system.</P><PCLASS="para">At one time (circa the time of the original UNIX paper in CACM), theResearch machine was a PDP 11/45 with a fixed-head disk, some RK05s, and anRP03.The root went on the fixed-head disk, since the absence of seek timesmade it fast. But fixed-head disks (anybody remember them?) were <EMCLASS="emphasis">tiny</EM>.Two megabytes [sic] was a big fixed-head disk. So you had to be fairlycareful to avoid overflowing the root filesystem (which included<EMCLASS="emphasis">/tmp</EM>-it wasn't a separate filesystem).<EMCLASS="emphasis">/usr</EM>, on the other hand, was the main filesystem on the 40-MB RP03.</P><PCLASS="para">So you had a very sharp split of hardware: things directly under <EMCLASS="emphasis">/</EM>,like <EMCLASS="emphasis">/tmp</EM>, <EMCLASS="emphasis">/bin</EM>, and <EMCLASS="emphasis">/lib</EM>, were fast but had to be small;things under <EMCLASS="emphasis">/usr</EM> could be big but accesses to them were slower.So you put the heavily used commands in <EMCLASS="emphasis">/bin</EM>, the heavily usedlibraries in <EMCLASS="emphasis">/lib</EM>, and [flourish of trumpets] the small temporaryfiles in <EMCLASS="emphasis">/tmp</EM>.All the other slush went under <EMCLASS="emphasis">/usr</EM>, including a <EMCLASS="emphasis">/usr/tmp</EM>directory for big temporaries.This is why a few programs like<SPANCLASS="link"><EMCLASS="emphasis">sort</EM> (<ACLASS="linkend"HREF="ch36_01.htm#UPT-ART-7640"TITLE="Putting Things in Order ">36.1</A>)</SPAN>put their temporaries in<EMCLASS="emphasis">/usr/tmp</EM>: they expect them to be big.[Though most <EMCLASS="emphasis">/usr</EM> filesystems are fast these days, a lot of systemsstill have much more room on <EMCLASS="emphasis">/usr/tmp</EM> than <EMCLASS="emphasis">/tmp</EM>. <EMCLASS="emphasis">-JP</EM>&nbsp;]</P><PCLASS="para">In practice, fixed-head disks are historical relics now, and much of thejustification for the various <EMCLASS="emphasis">/x</EM>-<EMCLASS="emphasis">/usr/x</EM> splits has disappeared. There is one reason why you might retain a <EMCLASS="emphasis">/tmp</EM>-<EMCLASS="emphasis">/usr/tmp</EM> split,however. If your <EMCLASS="emphasis">/tmp</EM> filesystem is kept in &quot;RAM disk&quot; or something similar forspeed,you might want to keep your editor temp files somewhere else if your editorhas<SPANCLASS="link">crash recovery (<ACLASS="linkend"HREF="ch30_24.htm"TITLE="vi/ex File Recovery vs. Networked Filesystems ">30.24</A>)</SPAN>.Crashrecovery definitely works better when the filesit is looking for are kept in nonvolatile memory!</P><DIVCLASS="sect1info"><PCLASS="SECT1INFO">- <SPANCLASS="authorinitials">HS</SPAN> <SPANCLASS="bibliomisc">in <ACLASS="systemitem.newsgroup"HREF="news:net.unix">net.unix</A> on Usenet, 19 March 1984</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="ch21_03.htm"TITLE="21.3 Unique Names for Temporary Files "><IMGSRC="gifs/txtpreva.gif"SRC="gifs/txtpreva.gif"ALT="Previous: 21.3 Unique Names for Temporary Files "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="ch21_05.htm"TITLE="21.5 What Good Is a File's Last Access Time? "><IMGSRC="gifs/txtnexta.gif"SRC="gifs/txtnexta.gif"ALT="Next: 21.5 What Good Is a File's Last Access Time? "BORDER="0"></A></TD></TR><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="172">21.3 Unique Names for Temporary Files </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">21.5 What Good Is a File's Last Access Time? </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 + -