📄 stty.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta name="generator" content="HTML Tidy, see www.w3.org"><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 --><!-- Copyright (c) 2001-2004 IEEE and The Open Group, All Rights Reserved --><title>stty</title></head><body bgcolor="white"><script type="text/javascript" language="JavaScript" src="../jscript/codes.js"></script><basefont size="3"> <a name="stty"></a> <a name="tag_04_135"></a><!-- stty --> <!--header start--><center><font size="2">The Open Group Base Specifications Issue 6<br>IEEE Std 1003.1, 2004 Edition<br>Copyright © 2001-2004 The IEEE and The Open Group, All Rights reserved.</font></center><!--header end--><hr size="2" noshade><h4><a name="tag_04_135_01"></a>NAME</h4><blockquote>stty - set the options for a terminal</blockquote><h4><a name="tag_04_135_02"></a>SYNOPSIS</h4><blockquote class="synopsis"><p><code><tt>stty</tt> <b>[</b> <tt>-a| -g</tt><b>]</b><tt><br><br>stty</tt> <i>operands</i><tt><br></tt></code></p></blockquote><h4><a name="tag_04_135_03"></a>DESCRIPTION</h4><blockquote><p>The <i>stty</i> utility shall set or report on terminal I/O characteristics for the device that is its standard input. Withoutoptions or operands specified, it shall report the settings of certain characteristics, usually those that differ fromimplementation-defined defaults. Otherwise, it shall modify the terminal state according to the specified operands. Detailedinformation about the modes listed in the first five groups below are described in the Base Definitions volume ofIEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap11.html#tag_11">Chapter 11, General Terminal Interface</a>. Operandsin the Combination Modes group (see <a href="#tag_04_135_05_06">Combination Modes</a>) are implemented using operands in theprevious groups. Some combinations of operands are mutually-exclusive on some terminal types; the results of using suchcombinations are unspecified.</p><p>Typical implementations of this utility require a communications line configured to use the <b>termios</b> interface defined inthe System Interfaces volume of IEEE Std 1003.1-2001. On systems where none of these lines are available, and on linesnot currently configured to support the <b>termios</b> interface, some of the operands need not affect terminalcharacteristics.</p></blockquote><h4><a name="tag_04_135_04"></a>OPTIONS</h4><blockquote><p>The <i>stty</i> utility shall conform to the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap12.html#tag_12_02">Section 12.2, Utility Syntax Guidelines</a>.</p><p>The following options shall be supported:</p><dl compact><dt><b>-a</b></dt><dd>Write to standard output all the current settings for the terminal.</dd><dt><b>-g</b></dt><dd>Write to standard output all the current settings in an unspecified form that can be used as arguments to another invocation ofthe <i>stty</i> utility on the same system. The form used shall not contain any characters that would require quoting to avoid wordexpansion by the shell; see <a href="xcu_chap02.html#tag_02_06"><i>Word Expansions</i></a>.</dd></dl></blockquote><h4><a name="tag_04_135_05"></a>OPERANDS</h4><blockquote><p>The following operands shall be supported to set the terminal characteristics.</p><h5><a name="tag_04_135_05_01"></a>Control Modes</h5><dl compact><dt><b>parenb </b> (<b>-parenb</b>)</dt><dd>Enable (disable) parity generation and detection. This shall have the effect of setting (not setting) PARENB in the<b>termios</b> <i>c_cflag</i> field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap11.html#tag_11">Chapter 11, General Terminal Interface</a>.</dd><dt><b>parodd </b> (<b>-parodd</b>)</dt><dd>Select odd (even) parity. This shall have the effect of setting (not setting) PARODD in the <b>termios</b> <i>c_cflag</i> field, asdefined in the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap11.html#tag_11">Chapter 11,General Terminal Interface</a>.</dd><dt><b>cs5 cs6 cs7 cs8</b></dt><dd>Select character size, if possible. This shall have the effect of setting CS5, CS6, CS7, and CS8, respectively, in the<b>termios</b> <i>c_cflag</i> field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap11.html#tag_11">Chapter 11, General Terminal Interface</a>.</dd><dt><i>number</i></dt><dd>Set terminal baud rate to the number given, if possible. If the baud rate is set to zero, the modem control lines shall nolonger be asserted. This shall have the effect of setting the input and output <b>termios</b> baud rate values as defined in theBase Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap11.html#tag_11">Chapter 11, GeneralTerminal Interface</a>.</dd><dt><b>ispeed </b> <i>number</i></dt><dd>Set terminal input baud rate to the number given, if possible. If the input baud rate is set to zero, the input baud rate shallbe specified by the value of the output baud rate. This shall have the effect of setting the input <b>termios</b> baud rate valuesas defined in the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap11.html#tag_11">Chapter11, General Terminal Interface</a>.</dd><dt><b>ospeed </b> <i>number</i></dt><dd>Set terminal output baud rate to the number given, if possible. If the output baud rate is set to zero, the modem control linesshall no longer be asserted. This shall have the effect of setting the output <b>termios</b> baud rate values as defined in theBase Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap11.html#tag_11">Chapter 11, GeneralTerminal Interface</a>.</dd><dt><b>hupcl </b> (<b>-hupcl</b>)</dt><dd>Stop asserting modem control lines (do not stop asserting modem control lines) on last close. This shall have the effect ofsetting (not setting) HUPCL in the <b>termios</b> <i>c_cflag</i> field, as defined in the Base Definitions volume ofIEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap11.html#tag_11">Chapter 11, General Terminal Interface</a>.</dd><dt><b>hup </b> (<b>-hup</b>)</dt><dd>Equivalent to <b>hupcl</b>( <b>-hupcl</b>).</dd><dt><b>cstopb </b> (<b>-cstopb</b>)</dt><dd>Use two (one) stop bits per character. This shall have the effect of setting (not setting) CSTOPB in the <b>termios</b><i>c_cflag</i> field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap11.html#tag_11">Chapter 11, General Terminal Interface</a>.</dd><dt><b>cread </b> (<b>-cread</b>)</dt><dd>Enable (disable) the receiver. This shall have the effect of setting (not setting) CREAD in the <b>termios</b> <i>c_cflag</i>field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap11.html#tag_11">Chapter 11, General Terminal Interface</a>.</dd><dt><b>clocal </b> (<b>-clocal</b>)</dt><dd>Assume a line without (with) modem control. This shall have the effect of setting (not setting) CLOCAL in the <b>termios</b><i>c_cflag</i> field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap11.html#tag_11">Chapter 11, General Terminal Interface</a>.</dd></dl><p>It is unspecified whether <i>stty</i> shall report an error if an attempt to set a Control Mode fails.</p><h5><a name="tag_04_135_05_02"></a>Input Modes</h5><dl compact><dt><b>ignbrk </b> (<b>-ignbrk</b>)</dt><dd>Ignore (do not ignore) break on input. This shall have the effect of setting (not setting) IGNBRK in the <b>termios</b><i>c_iflag</i> field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap11.html#tag_11">Chapter 11, General Terminal Interface</a>.</dd><dt><b>brkint </b> (<b>-brkint</b>)</dt><dd>Signal (do not signal) INTR on break. This shall have the effect of setting (not setting) BRKINT in the <b>termios</b><i>c_iflag</i> field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap11.html#tag_11">Chapter 11, General Terminal Interface</a>.</dd><dt><b>ignpar </b> (<b>-ignpar</b>)</dt><dd>Ignore (do not ignore) bytes with parity errors. This shall have the effect of setting (not setting) IGNPAR in the<b>termios</b> <i>c_iflag</i> field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap11.html#tag_11">Chapter 11, General Terminal Interface</a>.</dd><dt><b>parmrk </b> (<b>-parmrk</b>)</dt><dd>Mark (do not mark) parity errors. This shall have the effect of setting (not setting) PARMRK in the <b>termios</b> <i>c_iflag</i>field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap11.html#tag_11">Chapter 11, General Terminal Interface</a>.</dd><dt><b>inpck </b> (<b>-inpck</b>)</dt><dd>Enable (disable) input parity checking. This shall have the effect of setting (not setting) INPCK in the <b>termios</b><i>c_iflag</i> field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap11.html#tag_11">Chapter 11, General Terminal Interface</a>.</dd><dt><b>istrip </b> (<b>-istrip</b>)</dt><dd>Strip (do not strip) input characters to seven bits. This shall have the effect of setting (not setting) ISTRIP in the<b>termios</b> <i>c_iflag</i> field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap11.html#tag_11">Chapter 11, General Terminal Interface</a>.</dd><dt><b>inlcr </b> (<b>-inlcr</b>)</dt><dd>Map (do not map) NL to CR on input. This shall have the effect of setting (not setting) INLCR in the <b>termios</b><i>c_iflag</i> field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap11.html#tag_11">Chapter 11, General Terminal Interface</a>.</dd><dt><b>igncr (-igncr)</b></dt><dd>Ignore (do not ignore) CR on input. This shall have the effect of setting (not setting) IGNCR in the <b>termios</b><i>c_iflag</i> field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap11.html#tag_11">Chapter 11, General Terminal Interface</a>.</dd><dt><b>icrnl </b> (<b>-icrnl</b>)</dt><dd>Map (do not map) CR to NL on input. This shall have the effect of setting (not setting) ICRNL in the <b>termios</b><i>c_iflag</i> field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap11.html#tag_11">Chapter 11, General Terminal Interface</a>.</dd><dt><b>ixon </b> (<b>-ixon</b>)</dt><dd>Enable (disable) START/STOP output control. Output from the system is stopped when the system receives STOP and started whenthe system receives START. This shall have the effect of setting (not setting) IXON in the <b>termios</b> <i>c_iflag</i> field, asdefined in the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap11.html#tag_11">Chapter 11,General Terminal Interface</a>.</dd><dt><b>ixany </b> (<b>-ixany</b>)</dt><dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">Allow any character to restart output. This shall have the effect of setting (not setting) IXANY in the <b>termios</b><i>c_iflag</i> field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap11.html#tag_11">Chapter 11, General Terminal Interface</a>. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd><dt><b>ixoff </b> (<b>-ixoff</b>)</dt><dd>Request that the system send (not send) STOP characters when the input queue is nearly full and START characters to resume datatransmission. This shall have the effect of setting (not setting) IXOFF in the <b>termios</b> <i>c_iflag</i> field, as defined inthe Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap11.html#tag_11">Chapter 11, GeneralTerminal Interface</a>.</dd></dl><h5><a name="tag_04_135_05_03"></a>Output Modes</h5><dl compact><dt><b>opost </b> (<b>-opost</b>)</dt><dd>Post-process output (do not post-process output; ignore all other output modes). This shall have the effect of setting (notsetting) OPOST in the <b>termios</b> <i>c_oflag</i> field, as defined in the Base Definitions volume ofIEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap11.html#tag_11">Chapter 11, General Terminal Interface</a>.</dd><dt><b>ocrnl </b> (<b>-ocrnl</b>)</dt><dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">Map (do not map) CR to NL on output This shall have the effect of setting (not setting) OCRNL in the <b>termios</b> <i>c_oflag</i>field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap11.html#tag_11">Chapter 11, General Terminal Interface</a>.</dd><dt><b>onocr </b> (<b>-onocr</b>)</dt><dd>Do not (do) output CR at column zero. This shall have the effect of setting (not setting) ONOCR in the <b>termios</b><i>c_oflag</i> field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap11.html#tag_11">Chapter 11, General Terminal Interface</a>.</dd><dt><b>onlret </b> (<b>-onlret</b>)</dt><dd>The terminal newline key performs (does not perform) the CR function. This shall have the effect of setting (not setting)ONLRET in the <b>termios</b> <i>c_oflag</i> field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, <ahref="../basedefs/xbd_chap11.html#tag_11">Chapter 11, General Terminal Interface</a>.</dd><dt><b>ofill </b> (<b>-ofill</b>)</dt><dd>Use fill characters (use timing) for delays. This shall have the effect of setting (not setting) OFILL in the <b>termios</b><i>c_oflag</i> field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap11.html#tag_11">Chapter 11, General Terminal Interface</a>.</dd><dt><b>ofdel </b> (<b>-ofdel</b>)</dt><dd>Fill characters are DELs (NULs). This shall have the effect of setting (not setting) OFDEL in the <b>termios</b> <i>c_oflag</i>field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap11.html#tag_11">Chapter 11, General Terminal Interface</a>.</dd><dt><b>cr0 cr1 cr2 cr3</b></dt><dd>Select the style of delay for CRs. This shall have the effect of setting CRDLY to CR0, CR1, CR2, or CR3, respectively, in the<b>termios</b> <i>c_oflag</i> field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap11.html#tag_11">Chapter 11, General Terminal Interface</a>.</dd><dt><b>nl0 nl1</b></dt><dd>Select the style of delay for NL. This shall have the effect of setting NLDLY to NL0 or NL1, respectively, in the<b>termios</b> <i>c_oflag</i> field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap11.html#tag_11">Chapter 11, General Terminal Interface</a>.</dd><dt><b>tab0 tab1 tab2 tab3</b></dt><dd>Select the style of delay for horizontal tabs. This shall have the effect of setting TABDLY to TAB0, TAB1, TAB2, or TAB3,respectively, in the <b>termios</b> <i>c_oflag</i> field, as defined in the Base Definitions volume ofIEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap11.html#tag_11">Chapter 11, General Terminal Interface</a>. Note thatTAB3 has the effect of expanding <tab>s to <space>s.</dd><dt><b>tabs </b> (<b>-tabs</b>)</dt><dd>Synonym for <b>tab0</b> ( <b>tab3</b>).</dd><dt><b>bs0 bs1</b></dt><dd>Select the style of delay for backspaces. This shall have the effect of setting BSDLY to BS0 or BS1, respectively, in the<b>termios</b> <i>c_oflag</i> field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap11.html#tag_11">Chapter 11, General Terminal Interface</a>.</dd><dt><b>ff0 ff1</b></dt><dd>Select the style of delay for form-feeds. This shall have the effect of setting FFDLY to FF0 or FF1, respectively, in the<b>termios</b> <i>c_oflag</i> field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap11.html#tag_11">Chapter 11, General Terminal Interface</a>.</dd><dt><b>vt0 vt1</b></dt><dd>Select the style of delay for vertical-tabs. This shall have the effect of setting VTDLY to VT0 or VT1, respectively, in the<b>termios</b> <i>c_oflag</i> field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap11.html#tag_11">Chapter 11, General Terminal Interface</a>. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd></dl><h5><a name="tag_04_135_05_04"></a>Local Modes</h5><dl compact><dt><b>isig </b> (<b>-isig</b>)</dt><dd>Enable (disable) the checking of characters against the special control characters INTR, QUIT, and SUSP. This shall have theeffect of setting (not setting) ISIG in the <b>termios</b> <i>c_lflag</i> field, as defined in the Base Definitions volume ofIEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap11.html#tag_11">Chapter 11, General Terminal Interface</a>.</dd><dt><b>icanon </b> (<b>-icanon</b>)</dt><dd>Enable (disable) canonical input (ERASE and KILL processing). This shall have the effect of setting (not setting) ICANON in the<b>termios</b> <i>c_lflag</i> field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap11.html#tag_11">Chapter 11, General Terminal Interface</a>.</dd><dt><b>iexten </b> (<b>-iexten</b>)</dt><dd>Enable (disable) any implementation-defined special control characters not currently controlled by <b>icanon</b>, <b>isig</b>,<b>ixon</b>, or <b>ixoff</b>. This shall have the effect of setting (not setting) IEXTEN in the <b>termios</b> <i>c_lflag</i>field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap11.html#tag_11">Chapter 11, General Terminal Interface</a>.</dd><dt><b>echo </b> (<b>-echo</b>)</dt><dd>Echo back (do not echo back) every character typed. This shall have the effect of setting (not setting) ECHO in the<b>termios</b> <i>c_lflag</i> field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap11.html#tag_11">Chapter 11, General Terminal Interface</a>.</dd><dt><b>echoe </b> (<b>-echoe</b>)</dt><dd>The ERASE character visually erases (does not erase) the last character in the current line from the display, if possible. Thisshall have the effect of setting (not setting) ECHOE in the <b>termios</b> <i>c_lflag</i> field, as defined in the Base Definitionsvolume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap11.html#tag_11">Chapter 11, General TerminalInterface</a>.</dd><dt><b>echok </b> (<b>-echok</b>)</dt><dd>Echo (do not echo) NL after KILL character. This shall have the effect of setting (not setting) ECHOK in the <b>termios</b><i>c_lflag</i> field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap11.html#tag_11">Chapter 11, General Terminal Interface</a>.</dd><dt><b>echonl </b> (<b>-echonl</b>)</dt><dd>Echo (do not echo) NL, even if <b>echo</b> is disabled. This shall have the effect of setting (not setting) ECHONL in the<b>termios</b> <i>c_lflag</i> field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap11.html#tag_11">Chapter 11, General Terminal Interface</a>.</dd><dt><b>noflsh </b> (<b>-noflsh</b>)</dt><dd>Disable (enable) flush after INTR, QUIT, SUSP. This shall have the effect of setting (not setting) NOFLSH in the <b>termios</b><i>c_lflag</i> field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap11.html#tag_11">Chapter 11, General Terminal Interface</a>.</dd><dt><b>tostop </b> (<b>-tostop</b>)</dt><dd>Send SIGTTOU for background output. This shall have the effect of setting (not setting) TOSTOP in the <b>termios</b><i>c_lflag</i> field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap11.html#tag_11">Chapter 11, General Terminal Interface</a>.</dd></dl><h5><a name="tag_04_135_05_05"></a>Special Control Character Assignments</h5><dl compact><dt><<i>control</i>>-<i>character string</i></dt><dd>Set <<i>control</i>>-<i>character</i> to <i>string</i>. If <<i>control</i>>-<i>character</i> is one of the charactersequences in the first column of the following table, the corresponding Base Definitions volume of IEEE Std 1003.1-2001,<a href="../basedefs/xbd_chap11.html#tag_11">Chapter 11, General Terminal Interface</a> control character from the second columnshall be recognized. This has the effect of setting the corresponding element of the <b>termios</b> <i>c_cc</i> array (see the BaseDefinitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap13.html#tag_13">Chapter 13, Headers</a>, <ahref="../basedefs/termios.h.html"><i><termios.h></i></a>).<br><center><b>Table: Control Character Names in <i>stty</i></b></center><center><table border="1" cellpadding="3" align="center"><tr valign="top"><th align="center"><p class="tent"><b>Control Character</b></p></th><th align="center"><p class="tent"><b>c_cc Subscript</b></p></th><th align="center"><p class="tent"><b>Description</b></p></th></tr><tr valign="top"><td align="left"><p class="tent"><b>eof</b></p></td><td align="left"><p class="tent">VEOF</p></td><td align="left"><p class="tent">EOF character</p></td></tr><tr valign="top"><td align="left"><p class="tent"><b>eol</b></p></td>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -