📄 ch02_01.htm
字号:
<a name="IXT-2-121851" /><a name="IXT-2-121852" />Cancel print requests made with <tt class="literal">lp</tt>.The request can be specified by its ID, by the <em class="emphasis">printer</em>on which it is currently printing, or by the usernameassociated with the request (only privileged users can cancelanother user's print requests).Use <tt class="literal">lpstat</tt> to determine either the <em class="emphasis">id</em> orthe <em class="emphasis">printer</em> to cancel.</p><h4 class="refsect2">Options</h4><dl><dt><i><tt><em class="replaceable"><tt>id</em></tt></i></dt><dd>Cancel print request <em class="emphasis">id</tt></em></tt>.</p></dd><dt><tt class="literal">-u</tt> <tt><em class="replaceable">user</em></tt></dt><dd>Cancel request associated with <em class="emphasis">user</em></tt>.</p></dd></dl></td></tr><tr><td valign="top"><a name="cat">cat</a></a></td><td><tt class="literal">cat</tt> [<em class="replaceable"><tt>options</em>] [<em class="replaceable">files</tt></em>]<p><a name="IXT-2-121853" /><a name="IXT-2-121854" /><a name="IXT-2-121855" /><a name="IXT-2-121856" /><a name="IXT-2-121857" />Read one or more <em class="emphasis">files</em> and print them on standard output.Read standard input if no <em class="emphasis">files</em> are specified or if <tt class="literal">–</tt>is specifiedas one of the files; end input with <em class="emphasis">EOF</em>.Use the <tt class="literal">></tt> shell operator to combine several files intoa new file; <tt class="literal">>></tt> appends files to an existing file.</p><h4 class="refsect2">Options</h4><dl><dt><tt class="literal">-b</tt></dt><dd>Like <tt class="literal">-n</tt>, but don't number blank lines. Solaris only.</p></dd><dt><tt class="literal">-e</tt></dt><dd>Print a <tt class="literal">$</tt> to mark the end of each line. Must be used with <tt class="literal">-v</tt>.</p></dd><dt><tt class="literal">-n</tt></dt><dd>Number lines. Solaris only.</p></dd><dt><tt class="literal">-s</tt></dt><dd>Suppress messages about nonexistent files. (Note: On some systems,<tt class="literal">-s</tt> squeezes out extra blank lines.)</p></dd><dt><tt class="literal">-t</tt></dt><dd>Print each tab as <tt class="literal">^I</tt> and each form feed as <tt class="literal">^L</tt>.Must be used with <tt class="literal">-v</tt>.</p></dd><dt><tt class="literal">-u</tt></dt><dd>Print output as unbuffered (default is buffered in blocks orscreen lines).</p></dd><dt><tt class="literal">-v</tt></dt><dd>Display control characters and other nonprinting characters.</p></dd></dl><h4 class="refsect2">Examples</h4><blockquote><pre class="code"><tt class="userinput"><b>cat ch1 </b></tt> <i class="lineannotation">Display a file</i><tt class="userinput"><b>cat ch1 ch2 ch3 > all </b></tt> <i class="lineannotation">Combine files</i><tt class="userinput"><b>cat note5 >> notes </b></tt> <i class="lineannotation">Append to a file</i><tt class="userinput"><b>cat > temp1 </b></tt> <i class="lineannotation">Create file at terminal; end with EOF</i><tt class="userinput"><b>cat > temp2 << STOP </b></tt> <i class="lineannotation">Create file at terminal; end with STOP</i></pre></blockquote></td></tr><tr><td valign="top"><a name="cb">cb</a></a></td><td><tt class="literal">cb</tt> [<tt><em class="replaceable"><tt>options</em></tt>] [<tt><em class="replaceable">files</tt></em></tt>]<p><a name="IXT-2-121858" /><a name="IXT-2-121859" /><a name="IXT-2-121860" />C program “beautifier” that formats <em class="emphasis">files</em></tt> using proper C programmingstructure.</p><h4 class="refsect2">Options</h4><dl><dt><tt class="literal">-j</tt></dt><dd>Join split lines.</p></dd><dt><tt class="literal">-l</tt> <tt><em class="replaceable">length</em></tt></dt><dd>Split lines longer than <em class="emphasis">length</em></tt>.</p></dd><dt><tt class="literal">-s</tt></dt><dd>Standardize code to style of Kernighan and Ritchie in <em class="citetitle">The CProgramming Language</em>.</p></dd><dt><tt class="literal">-V</tt></dt><dd>Print the version of <tt class="literal">cb</tt> on standard error.</p></dd></dl><h4 class="refsect2">Example</h4><blockquote><pre class="code"><tt class="userinput"><b>cb -l 70 calc.c > calc_new.c</b></tt></pre></blockquote></td></tr><tr><td valign="top"><a name="cc">cc</a></a></td><td><tt class="literal">/usr/ccs/bin/cc</tt> [<tt><em class="replaceable"><tt>options</em></tt>] <tt><em class="replaceable">files</tt></em></tt><p><a name="IXT-2-121861" /><a name="IXT-2-121862" /><a name="IXT-2-121863" /><a name="IXT-2-121864" /><a name="IXT-2-121865" />Compile one or more C source files (<em class="emphasis">file</em></tt><tt class="literal">.c</tt>),assembler source files (<em class="emphasis">file</em></tt><tt class="literal">.s</tt>),or preprocessed C source files (<em class="emphasis">file</em></tt><tt class="literal">.i</tt>).<tt class="literal">cc</tt> automatically invokes the loader <tt class="literal">ld</tt>(unless <tt class="literal">-c</tt> is supplied).In some cases, <tt class="literal">cc</tt> generates an object filehaving a <tt class="literal">.o</tt> suffix and a corresponding root name.By default, output is placed in <tt class="literal">a.out</tt>.<tt class="literal">cc</tt> accepts additional system-specific options.</p><h4 class="refsect2">Notes</h4><ul><li><p>Add <tt class="literal">/usr/ccs/bin</tt> to your PATHto use the C compiler and other C Compilation System tools.This command runs the ANSI C compiler;use <tt class="literal">/usr/bin/cc</tt> if you want to run the compiler forpre-ANSI C.</p></li><li><p>Solaris 7 does not come with a C compiler.You must purchase one separately from Sun, or download the GNUC Compiler (GCC) fromhttp://www.sunfreeware.com.</p></li><li><p>Options for <tt class="literal">cc</tt> vary wildly across Unix systems.We have chosen here to document only those options that arecommonly available.You will need to check your local documentationfor complete information.</p></li><li><p>Usually, <tt class="literal">cc</tt> passes anyunrecognized options to the loader, <tt class="literal">ld</tt>.</p></li></ul><h4 class="refsect2">Options</h4><dl><dt><tt class="literal">-c</tt></dt><dd>Suppress loading and keep any object files that were produced.</p></dd><dt><tt class="literal">-D</tt><tt><em class="replaceable">name</em></tt>[<tt class="literal">=</tt><tt><em class="replaceable">def</em></tt>]</dt><dd>Supply a <tt class="literal">#define</tt> directive, defining <em class="emphasis">name</em></tt> to be <em class="emphasis">def</em></tt>or, if no <em class="emphasis">def</em></tt> is given, the value <tt class="literal">1</tt>.</p></dd><dt><tt class="literal">-E</tt></dt><dd>Run only the macro preprocessor, sending results to standard output.</p></dd><dt><tt class="literal">-g</tt></dt><dd>Generate more symbol-table information needed for debuggers.</p></dd><dt><tt class="literal">-I</tt><tt><em class="replaceable">dir</em></tt></dt><dd>Search for include files in directory <em class="emphasis">dir</em></tt> (in additionto standard locations). Supply a <tt class="literal">-I</tt> for each new <em class="emphasis">dir</em>to be searched.</p></dd><dt><tt class="literal">-l</tt><tt><em class="replaceable">name</em></tt></dt><dd>Link source <em class="emphasis">file</em></tt> with library files<tt class="literal">lib</tt><em class="emphasis">name</em></tt><tt class="literal">.so</tt>or <tt class="literal">lib</tt><em class="emphasis">name</em></tt><tt class="literal">.a</tt>.</p></dd><dt><tt class="literal">-L</tt><tt><em class="replaceable">dir</em></tt></dt><dd>Like <tt class="literal">-I</tt>, but search <em class="emphasis">dir</em></tt> for library archives.</p></dd><dt><tt class="literal">-o</tt> <tt><em class="replaceable">file</em></tt></dt><dd>Send object output to <em class="emphasis">file</em></tt> instead of to <tt class="literal">a.out</tt>.</p></dd><dt><tt class="literal">-O</tt></dt><dd>Optimize object code (produced from <tt class="literal">.c</tt> or <tt class="literal">.i</tt> files).</p></dd><dt><tt class="literal">-p</tt></dt><dd><a name="IXT-2-121866" />Generate benchmark code to count the times each routine is called.File <tt class="literal">mon.out</tt> is created, so<tt class="literal">prof</tt> can be used later to produce an execution profile.</p></dd><dt><tt class="literal">-P</tt></dt><dd>Run only the preprocessor and place the result in <em class="emphasis">file</em></tt><tt class="literal">.i</tt>.</p></dd><dt><tt class="literal">-S</tt></dt><dd>Compile (and optimize, if <tt class="literal">-O</tt> is supplied),but don't assemble or load;assembler output is placed in <em class="emphasis">file</em></tt><tt class="literal">.s</tt>.</p></dd><dt><tt class="literal">-U</tt><tt><em class="replaceable">name</em></tt></dt><dd>Remove definition of name, as if through an <tt class="literal">#undef</tt> directive.</p></dd></dl><h4 class="refsect2">Example</h4><p>Compile <tt class="literal">xpop.c</tt> and load it with the X libraries:</p><blockquote><pre class="code"><tt class="userinput"><b>cc -o xpop xpop.c -lXaw -lXmu -lXt -lX11</b></tt></pre></blockquote></td></tr><tr><td valign="top"><a name="cd">cd</a></a></td><td><tt class="literal">cd</tt> [<em class="replaceable"><tt>dir</tt></em>]<p><a name="IXT-2-121867" /><a name="IXT-2-121868" /><a name="IXT-2-121869" />Change directory. <tt class="literal">cd</tt> is a built-in shell command. See<a href="ch04_01.htm">Chapter 4</a>, and<a href="ch05_01.htm">Chapter 5</a>.</p></td></tr><tr><td valign="top"><a name="cdc">cdc</a></a></td><td><p><tt class="literal">/usr/ccs/bin/cdc</tt> <tt class="literal">-r</tt><em class="replaceable"><tt>sid</em> [<em class="replaceable">option</em>] <em class="replaceable">files</tt></em></p><p>An SCCS command. See <a href="ch18_01.htm">Chapter 18</a>.</p></td></tr><tr><td valign="top"><a name="cde">cde</a></a></td><td><div class="sect2"><h3 class="sect2">Common Desktop Environment</h3><p><a name="IXT-2-121870" /><a name="IXT-2-121871" />Solaris only.The Common Desktop Environment (CDE) is the defaultgraphical user interface (GUI) on Solaris systems.Solaris 7 users may choose between CDE and OpenWindows,but OpenWindows is marked as obsolete and not supportedpast Solaris 7.</p><p>Documenting CDE would require its own book and is beyond thescope of this one.Instead, listed here are some of the more useful individualCDE commands, which are kept in <tt class="literal">/usr/dt/bin</tt>.(<b>C</b>ommands for the <b class="emphasis-bold">d</b>esk<b class="emphasis-bold">t</b>op.)In addition, a number of OpenWindows commands are still useful.See the listing under <b class="emphasis-bold"><a href="#openwin">openwin</a></b>in <a href="appb_01.htm">Appendix B</a>.</p></div><h4 class="refsect2">Useful CDE Programs</h4><p>The following CDE and Sun Desktop commands may be of interest.Check the manpages for more information.</p><table border="1" cellpadding="3"><tr><td><tt class="literal">answerbook2</tt></td><td><p>Sun hypertext documentation viewer.</p></td></tr><tr><td><tt class="literal">dtaction</tt></td><td><p>Invoke CDE actions from within shell scripts.</p></td></tr><tr><td><tt class="literal">dtbuilder</tt></td><td><p>CDE applications builder.</p></td></tr><tr><td><tt class="literal">dtcalc</tt></td><td><p>Onscreen scientific, logical, and financial calculator.</p></td></tr><tr><td><tt class="literal">dtcm</tt></td><td><p>Calendar manager.</p></td></tr>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -