📄 ch02_01.htm
字号:
<html><head><title>Unix Commands (UNIX in a Nutshell: System V Edition)</title><link rel="stylesheet" type="text/css" href="../style/style1.css" /><meta name="DC.Creator" content="Arnold Robbins" /><meta name="DC.Format" content="text/xml" scheme="MIME" /><meta name="DC.Language" content="en-US" /><meta name="DC.Publisher" content="O'Reilly & Associates, Inc." /><meta name="DC.Source" scheme="ISBN" content="1-56592-427-4" /><meta name="DC.Subject.Keyword" content="stuff" /><meta name="DC.Title" content="UNIX in a Nutshell: System V Edition" /><meta name="DC.Type" content="Text.Monograph" /></head><body bgcolor="#ffffff"><img src="gifs/smbanner.gif" usemap="#banner-map" border="0" alt="Book Home" /><map name="banner-map"><area shape="rect" coords="1,-2,616,66" href="index.htm" alt="Book Title" /><area shape="rect" coords="629,-11,726,25" href="jobjects/fsearch.htm" alt="Search this book" /></map><div class="navbar"><table width="684" border="0"><tr><td align="left" valign="top" width="228"><a href="ch01_06.htm"><img src="../gifs/txtpreva.gif" alt="Previous" border="0" /></a></td><td align="center" valign="top" width="228" /><td align="right" valign="top" width="228"><a href="ch03_01.htm"><img src="../gifs/txtnexta.gif" alt="Next" border="0" /></a></td></tr></table></div><h1 class="chapter">Chapter 2. Unix Commands</h1><div class="htmltoc"><h4 class="tochead">Contents:</h4><p><a href="ch02_01.htm#sect1">Alphabetical Summary of Commands</a><br /></p></div><p>This chapter presents the Unix commands of interest to users and programmers.Most of these commands appear in the “Commands” sectionof the <em class="citetitle">User's Reference Manual</em> and<em class="citetitle">Programmer's Reference Manual</em> for Unix System V Release 4(SVR4).<a name="IXT-2-121796" />This chapter describes additional commandsfrom the compatibility packages; these commands are prefixed with<tt class="literal">/usr/ucb</tt>, the name of the directory in which they reside.Also included here are commands specific to Solaris 7,such as those for using Java and the occasional absolutelyessential program available from the Internet.</p><p><a name="IXT-2-121797" /><a name="IXT-2-121798" /><a name="IXT-2-121799" /><a name="IXT-2-121800" /><a name="IXT-2-121801" />Particularly on Solaris, useful commands are spread across a number ofdifferent “bin” directories, such as<tt class="literal">/usr/ccs/bin</tt>,<tt class="literal">/usr/dt/bin</tt>,<tt class="literal">/usr/java/bin</tt>,and<tt class="literal">/usr/openwin/bin</tt>,and not just <tt class="literal">/usr/bin</tt> and <tt class="literal">/usr/ucb</tt>.In such cases, this book provides the full pathname, e.g.,<tt class="literal">/usr/ccs/bin/make</tt>.In some instances, a symbolic linkfor acommand exists in <tt class="literal">/usr/bin</tt> to the actual command elsewhere.</p><p>Each entry is labeled with the command name on the outer edge of thepage. The syntax line is followed by a brief description and a listof all available options.Many commands come with examples at the end of the entry.If you need only a quick reminder or suggestion about a command,you can skip directly to the examples.</p><p>Note: comments such as "SVR4 only," or "Solaris only," compareonly those two systems. Many "Solaris only" commands and/or optionsare commonly available on other Unix systems as well.</p><p>Some options can be invoked only by a user with special system privileges.Such a person is often called a “superuser.”This book uses the term <em class="emphasis">privileged user</em> instead.</p><p>Typographic conventions for describing command syntax arelisted in the Preface. For additional help in locating commands,see the Index.</p><div class="sect1"><a name="unut-ch-2-sect-1" /><h2 class="sect1"><a name="sect1" />2.1. Alphabetical Summary of Commands</h2><a name="ch02.commandlist1" /><a name="ch02.commandlist2" /><table border="1" cellpadding="5"><tr><td valign="top"><a name="addbib">addbib</a></a></td><td><p><tt class="literal">addbib</tt> [<em class="replaceable"><tt>options</em>] <em class="replaceable">database</tt></em></p><p>Part of the <tt class="literal">refer</tt> suite of programs.See <a href="ch17_01.htm">Chapter 17</a>.</p></td></tr><tr><td valign="top"><a name="admin">admin</a></a></td><td><tt class="literal">/usr/ccs/bin/admin</tt> [<em class="replaceable"><tt>options</em>] <em class="replaceable">files</tt></em><p>An SCCS command. See <a href="ch18_01.htm">Chapter 18</a>.</p></td></tr><tr><td valign="top"><a name="appletviewer">appletviewer</a></a></td><td><tt class="literal">/usr/java/bin/appletviewer</tt> [<em class="replaceable"><tt>options</em>] <em class="replaceable">urls</tt></em></p><p><a name="IXT-2-121802" /><a name="IXT-2-121803" /><a name="IXT-2-121804" />Solaris only.Connect to the specified <em class="emphasis">urls</em> and run anyJava applets they specify in their own windows, outside thecontext of a web browser.</p><h4 class="refsect2">Options</h4><dl><dt><tt class="literal">-debug</tt></dt><dd>Run the applet viewer from within the Java debugger, <tt class="literal">jdb</tt>.</p></dd><dt><tt class="literal">-encoding</tt> <tt><em class="replaceable">name</em></tt></dt><dd>Specify the input HTML file encoding.</p></dd><dt><tt class="literal">-J</tt> <tt><em class="replaceable">opt</em></tt></dt><dd>Pass <em class="emphasis">opt</em></tt> on to the <tt class="literal">java</tt>command. <em class="emphasis">opt</em></tt> should not contain spaces; usemultiple <tt class="literal">-J</tt> options if necessary.</p></dd></dl></td></tr><tr><td valign="top"><a name="apropos">apropos</a></a></td><td><tt class="literal">apropos</tt> <tt><em class="replaceable"><tt>keywords</tt></em></tt><p><a name="IXT-2-121805" /><a name="IXT-2-121806" /><a name="IXT-2-121807" />Look up one or more <em class="emphasis">keywords</em></tt> in the online manpages.Same as <tt class="literal">man -k</tt>. See also <b class="emphasis-bold"><a href="#whatis">whatis</a></b>.</p></td></tr><tr><td valign="top"><a name="ar">ar</a></a></td><td><tt class="literal">/usr/ccs/bin/ar</tt> [<tt class="literal">-V</tt>] <tt><em class="replaceable"><tt>key</em></tt> [<tt><em class="replaceable">args</em></tt>] [<tt><em class="replaceable">posname</em></tt>] <tt><em class="replaceable">archive</em></tt> [<tt><em class="replaceable">files</tt></em></tt>]<p><a name="IXT-2-121808" /><a name="IXT-2-121809" /><a name="IXT-2-121810" /><a name="IXT-2-121811" /><a name="IXT-2-121812" /><a name="IXT-2-121813" /><a name="IXT-2-121814" /><a name="IXT-2-121815" />Maintain a group of <em class="emphasis">files</em></tt> that are combined intoa file <em class="emphasis">archive</em></tt>.Used most commonly to create and update library files as used by theloader (<tt class="literal">ld</tt>). Only one key letter may be used, but eachcan be combined with additional <em class="emphasis">args</em></tt> (with no separations between).<em class="emphasis">posname</em></tt> is the name of a file in <em class="emphasis">archive</em></tt>. When moving orreplacing <em class="emphasis">files</em></tt>, you can specify that they be placedbefore or after <em class="emphasis">posname</em></tt>.See <b class="emphasis-bold"><a href="#lorder">lorder</a></b>in <a href="appb_01.htm">Appendix B</a>,for another example.<tt class="literal">-V</tt> prints the version number of <tt class="literal">ar</tt> on standard error.</p><p>On Solaris, <em class="emphasis">key</em></tt> and <em class="emphasis">args</em></tt> can be precededwith a <tt class="literal">-</tt>, as though they were regular options.</p><h4 class="refsect2">Key</h4><table border="1" cellpadding="3"><tr><td><tt class="literal">d</tt></td><td><p>Delete <em class="emphasis">files</em></tt> from <em class="emphasis">archive</em></tt>.</p></td></tr><tr><td><tt class="literal">m</tt></td><td><p>Move <em class="emphasis">files</em></tt> to end of <em class="emphasis">archive</em></tt>.</p></td></tr><tr><td><tt class="literal">p</tt></td><td><p>Print <em class="emphasis">files</em></tt> in <em class="emphasis">archive</em></tt>.</p></td></tr><tr><td><tt class="literal">q</tt></td><td><p>Append <em class="emphasis">files</em></tt> to <em class="emphasis">archive</em></tt>.</p></td></tr><tr><td><tt class="literal">r</tt></td><td><p>Replace <em class="emphasis">files</em></tt> in <em class="emphasis">archive</em></tt>.</p></td></tr><tr><td><tt class="literal">t</tt></td><td><p>List the contents of <em class="emphasis">archive</em></tt> or list the named <em class="emphasis">files</em></tt>.</p></td></tr><tr><td><tt class="literal">x</tt></td><td><p>Extract contents from <em class="emphasis">archive</em></tt> or only the named <em class="emphasis">files</em></tt>.</p></td></tr></table><p><h4 class="refsect2">Args</h4><table border="1" cellpadding="3"><tr><td><tt class="literal">a</tt></td><td><p>Use with <tt class="literal">r</tt> or <tt class="literal">m</tt> to place <em class="emphasis">files</em></tt>in the archive after <em class="emphasis">posname</em></tt>.</p></td></tr><tr><td><tt class="literal">b</tt></td><td><p>Same as <tt class="literal">a</tt> but before <em class="emphasis">posname</em></tt>.</p></td></tr><tr><td><tt class="literal">c</tt></td><td><p>Create <em class="emphasis">archive</em></tt> silently.</p></td></tr><tr><td><tt class="literal">C</tt></td><td><p>Don't replace existing files of the same name with the oneextracted from the archive. Useful with <tt class="literal">T</tt>.Solaris only.</p></td></tr><tr><td><tt class="literal">i</tt></td><td><p>Same as <tt class="literal">b</tt>.</p></td></tr><tr><td><tt class="literal">s</tt></td><td><p>Force regeneration of <em class="emphasis">archive</em></tt> symbol table(useful after running <tt class="literal">strip</tt> or <tt class="literal">mcs</tt>).</p></td></tr><tr><td><tt class="literal">T</tt></td><td><p>Truncate long filenames when extracting onto filesystems that don'tsupport long filenames.Without this operation, extracting files with long filenames is an error.Solaris only.</p></td></tr><tr><td><tt class="literal">u</tt></td><td><p>Use with <tt class="literal">r</tt> to replaceonly <em class="emphasis">files</em></tt> that have changed since being put in <em class="emphasis">archive</em></tt>.</p></td></tr><tr><td><tt class="literal">v</tt></td><td><p>Verbose; print a description.</p></td></tr></table><p><h4 class="refsect2">Example</h4><p>Update the versions of object files in<tt class="literal">mylib.a</tt>with the ones in the current directory.Any files in <tt class="literal">mylib.a</tt> that are not in thecurrent directory are not replaced.</p><blockquote><pre class="code"><tt class="userinput"><b>ar r mylib.a *.o</b></tt></pre></blockquote></td></tr><tr><td valign="top"><a name="as">as</a></a></td><td><tt class="literal">/usr/ccs/bin/as</tt> [<tt><em class="replaceable"><tt>options</em></tt>] <tt><em class="replaceable">files</tt></em></tt><p><a name="IXT-2-121816" /><a name="IXT-2-121817" /><a name="IXT-2-121818" />Generate an object file from each specified assembly languagesource <em class="emphasis">file</em></tt>. Object files have the same root name assource files but replace the <tt class="literal">.s</tt> suffix with <tt class="literal">.o</tt>.There may be additional system-specific options.See also <b class="emphasis-bold"><a href="#dis">dis</a></b>.</p><h4 class="refsect2">Options</h4><dl><dt><tt class="literal">-m</tt></dt><dd>Run <tt class="literal">m4</tt> on <em class="emphasis">file</em></tt>.</p></dd><dt><tt class="literal">-n</tt></dt><dd>Turn off optimization of long/short addresses.</p></dd><dt><tt class="literal">-o</tt> <tt><em class="replaceable">objfile</em></tt></dt><dd>Place output in object file <em class="emphasis">objfile</em></tt>(default is <em class="emphasis">file</em><tt class="literal">.o</tt>).</p></dd><dt><tt class="literal">-Q</tt><tt><em class="replaceable">c</em></tt></dt><dd>Put the assembler's version number in the object file (when <em class="emphasis">c</em></tt> = <tt class="literal">y</tt>);default is not to put it (<em class="emphasis">c</em></tt> = <tt class="literal">n</tt>).</p></dd><dt><tt class="literal">-R</tt></dt><dd>Remove <em class="emphasis">file</em></tt> upon completion.</p></dd><dt><tt class="literal">-T</tt></dt><dd>Force obsolete assembler directives to be obeyed.</p></dd><dt><tt class="literal">-V</tt></dt><dd>Display the version number of the assembler.</p></dd><dt><tt class="literal">-Y</tt> [<tt><em class="replaceable">key</em></tt>,] <tt><em class="replaceable">dir</em></tt></dt><dd>Search directory <em class="emphasis">dir</em></tt> for the <tt class="literal">m4</tt> preprocessor(if <em class="emphasis">key</em></tt> is <tt class="literal">m</tt>),for the file containing predefined macros (if <em class="emphasis">key</em></tt> is <tt class="literal">d</tt>), orfor both (if <em class="emphasis">key</em></tt> is omitted).</p></dd></dl></td></tr><tr><td valign="top"><a name="at">at</a></a></td><td><p><tt class="literal">at</tt> <tt><em class="replaceable"><tt>options1</em></tt> <tt><em class="replaceable">time</em></tt> [<tt><em class="replaceable">date</em></tt>] [<tt class="literal">+</tt> <tt><em class="replaceable">increment</em></tt>]</p><p><tt class="literal">at</tt> <tt><em class="replaceable">options2</em></tt> [<tt><em class="replaceable">jobs</tt></em></tt>]</p><p><a name="IXT-2-121819" /><a name="IXT-2-121820" /><a name="IXT-2-121821" />Execute commands entered on standard input at a specified<em class="emphasis">time</em></tt> and optional <em class="emphasis">date</em></tt>.(See also <b class="emphasis-bold"><a href="#batch">batch</a></b>and <b class="emphasis-bold"><a href="#crontab">crontab</a></b>.)End input with <em class="emphasis">EOF</em></tt>. <em class="emphasis">time</em></tt> can be formed either
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -