📄 stty.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>stty</title></head><body bgcolor=white><center><font size=2>The Single UNIX ® Specification, Version 2<br>Copyright © 1997 The Open Group</font></center><hr size=2 noshade><h4><a name = "tag_001_014_2125"> </a>NAME</h4><blockquote>stty - set the options for a terminal</blockquote><h4><a name = "tag_001_014_2126"> </a>SYNOPSIS</h4><blockquote><pre><code>stty <b>[</b> -a| -g<b>]</b>stty <i>operands</i></code></pre></blockquote><h4><a name = "tag_001_014_2127"> </a>DESCRIPTION</h4><blockquote>The<i>stty</i>utility sets or reports on terminalI/Ocharacteristics for the device that is its standard input.Without options or operands specified,it reports the settings of certain characteristics,usually those that differ from implementation-dependent defaults.Otherwise, it modifies the terminal state according to thespecified operands.Detailed information about the modes listed in the first five groups beloware described in the <b>XBD</b> specification, <a href="../xbd/termios.html"><b>General Terminal Interface</b> </a> .Operands in the Combination Modes group(see<xref href=sttycomb><a href="#tag_001_014_2129_006">Combination Modes</a></xref>)are implemented using operands in the previous groups.Some combinations of operands are mutually exclusive on someterminal types; the results of using such combinations are unspecified.<p>Typical implementations of this utility require a communications lineconfigured to use a <b>XSH</b> specification <b>termios</b> interface.On systems where none of these lines are available, and on linesnot currently configured to support the <b>XSH</b> specification termiosinterface, some of the operands need not affect terminal characteristics.</blockquote><h4><a name = "tag_001_014_2128"> </a>OPTIONS</h4><blockquote>The<i>stty</i>utility supports the <b>XBD</b> specification, <a href="../xbd/utilconv.html#usg"><b>Utility Syntax Guidelines</b> </a> .<p>The following options are supported:<dl compact><dt><b>-a</b><dd>Write to standard output all the current settings for the terminal.<dt><b>-g</b><dd>Write to standard output all thecurrent settings in an unspecified form that can be used as argumentsto another invocation of the<i>stty</i>utility on the same system.The form used will not containany characters that would requirequoting to avoid word expansion by the shell; see<xref href=wordexp><a href="chap2.html#tag_001_006">Word Expansions</a></xref>.</dl></blockquote><h4><a name = "tag_001_014_2129"> </a>OPERANDS</h4><blockquote>The following operands are supportedto set the terminal characteristics:<h5><a name = "tag_001_014_2129_001"> </a>Control Modes</h5><dl compact><dt><b>parenb (-parenb)</b><dd>Enable (disable) parity generation and detection.This has the effect of setting (not setting)PARENB in the<b>termios</b><b>c_cflag</b>field, as defined in the <b>XBD</b> specification, <a href="../xbd/termios.html"><b>General Terminal Interface</b> </a> .<dt><b>parodd (-parodd)</b><dd>Select odd (even) parity.This has the effect of setting (not setting)PARODDin the<b>termios</b><b>c_cflag</b>field, as defined in the <b>XBD</b> specification, <a href="../xbd/termios.html"><b>General Terminal Interface</b> </a> .<dt><b>cs5 cs6 cs7 cs8</b><dd>Select character size, if possible.This has the effect of settingCS5,CS6,CS7andCS8,respectively, in the<b>termios</b><b>c_cflag</b>field, as defined in the <b>XBD</b> specification, <a href="../xbd/termios.html"><b>General Terminal Interface</b> </a> .<dt><i>number</i><dd>Set terminal baud rate to the number given, if possible.If the baud rate is set to zero, the modem control lines will no longer beasserted.This has the effect of setting the input and output<b>termios</b>baud rate values as defined in the <b>XBD</b> specification, <a href="../xbd/termios.html"><b>General Terminal Interface</b> </a> .<dt><b>ispeed </b><i>number</i><dd>Set terminal input baud rate to the number given, if possible.If the input baud rate is set to zero, the input baud ratewill be specified by the value of the output baud rate.This has the effect of setting the input<b>termios</b>baud rate values as defined in the <b>XBD</b> specification, <a href="../xbd/termios.html"><b>General Terminal Interface</b> </a> .<dt><b>ospeed </b><i>number</i><dd>Set terminal output baud rate to the number given, if possible.If the output baud rate is set to zero,the modem control lines will no longer be asserted.This has the effect of setting the output<b>termios</b>baud rate values as defined in the <b>XBD</b> specification, <a href="../xbd/termios.html"><b>General Terminal Interface</b> </a> .<dt><b>hupcl (-hupcl)</b><dd>Stop asserting modem control lines (do not stop assertingmodem control lines) on last close.This has the effect of setting (not setting)HUPCLin the<b>termios</b><b>c_cflag</b>field, as defined in the <b>XBD</b> specification, <a href="../xbd/termios.html"><b>General Terminal Interface</b> </a> .<dt><b>hup (-hup)</b><dd>Same as <b>hupcl</b> (<b>-hupcl</b>).<dt><b>cstopb (-cstopb)</b><dd>Use two (one) stop bits per character.This has the effect of setting (not setting)CSTOPBin the<b>termios</b><b>c_cflag</b>field, as defined in the <b>XBD</b> specification, <a href="../xbd/termios.html"><b>General Terminal Interface</b> </a> .<dt><b>cread (-cread)</b><dd>Enable (disable) the receiver.This has the effect of setting (not setting)CREADin the<b>termios</b><b>c_cflag</b>field, as defined in the <b>XBD</b> specification, <a href="../xbd/termios.html"><b>General Terminal Interface</b> </a> .<dt><b>clocal (-clocal)</b><dd>Assume a line without (with) modem control.This has the effect of setting (not setting)CLOCALin the<b>termios</b><b>c_cflag</b>field, as defined in the <b>XBD</b> specification, <a href="../xbd/termios.html"><b>General Terminal Interface</b> </a> .</dl><p>It is unspecified whether<i>stty</i>will report an error if an attempt to set a Control Mode fails.<h5><a name = "tag_001_014_2129_002"> </a>Input Modes</h5><dl compact><dt><b>ignbrk (-ignbrk)</b><dd>Ignore (do not ignore) break on input.This has the effect of setting (not setting)IGNBRKin the<b>termios</b><b>c_iflag</b>field, as defined in the <b>XBD</b> specification, <a href="../xbd/termios.html"><b>General Terminal Interface</b> </a> .<dt><b>brkint (-brkint)</b><dd>Signal (do not signal)INTRon break.This has the effect of setting (not setting)BRKINTin the<b>termios</b><b>c_iflag</b>field, as defined in the <b>XBD</b> specification, <a href="../xbd/termios.html"><b>General Terminal Interface</b> </a> .<dt><b>ignpar (-ignpar)</b><dd>Ignore (do not ignore) bytes with parity errors.This has the effect of setting (not setting)IGNPARin the<b>termios</b><b>c_iflag</b>field, as defined in the <b>XBD</b> specification, <a href="../xbd/termios.html"><b>General Terminal Interface</b> </a> .<dt><b>parmrk (-parmrk)</b><dd>Mark (do not mark) parity errors.This has the effect of setting (not setting)PARMRKin the<b>termios</b><b>c_iflag</b>field, as defined in the <b>XBD</b> specification, <a href="../xbd/termios.html"><b>General Terminal Interface</b> </a> .<dt><b>inpck (-inpck)</b><dd>Enable (disable) input parity checking.This has the effect of setting (not setting)INPCKin the<b>termios</b><b>c_iflag</b>field, as defined in the <b>XBD</b> specification, <a href="../xbd/termios.html"><b>General Terminal Interface</b> </a> .<dt><b>istrip (-istrip)</b><dd>Strip (do not strip) input characters to seven bits.This has the effect of setting (not setting)ISTRIPin the<b>termios</b><b>c_iflag</b>field, as defined in the <b>XBD</b> specification, <a href="../xbd/termios.html"><b>General Terminal Interface</b> </a> .<dt><b>inlcr (-inlcr)</b><dd>Map (do not map)NLtoCRon input.This has the effect of setting (not setting)INLCRin the<b>termios</b><b>c_iflag</b>field, as defined in the <b>XBD</b> specification, <a href="../xbd/termios.html"><b>General Terminal Interface</b> </a> .<dt><b>igncr (-igncr)</b><dd>Ignore (do not ignore)CRon input.This has the effect of setting (not setting)IGNCRin the<b>termios</b><b>c_iflag</b>field, as defined in the <b>XBD</b> specification, <a href="../xbd/termios.html"><b>General Terminal Interface</b> </a> .<dt><b>icrnl (-icrnl)</b><dd>Map (do not map)CRtoNLon input.This has the effect of setting (not setting)ICRNLin the<b>termios</b><b>c_iflag</b>field, as defined in the <b>XBD</b> specification, <a href="../xbd/termios.html"><b>General Terminal Interface</b> </a> .<dt><b>iuclc (-iuclc)</b><dd>Map (do not map)upper-case alphabetics to lower-case on input.This has the effect of setting (not setting)IUCLCin the<b>termios</b><b>c_iflag</b>field, as defined in the <b>XBD</b> specification, <a href="../xbd/termios.html"><b>General Terminal Interface</b> </a> . (<b>LEGACY</b>)<dt><b>ixon (-ixon)</b><dd>Enable (disable)START/STOPoutput control.Output from the system is stopped when the system receivesSTOPand started when the system receivesSTART.This has the effect of setting (not setting)IXONin the<b>termios</b><b>c_iflag</b>field, as defined in the <b>XBD</b> specification, <a href="../xbd/termios.html"><b>General Terminal Interface</b> </a> .<dt><b>ixany (-ixany)</b><dd>Allow any character to restart output.This has the effect of setting (not setting)IXANYin the<b>termios</b><b>c_iflag</b>field, as defined in the <b>XBD</b> specification, <a href="../xbd/termios.html"><b>General Terminal Interface</b> </a> .<dt><b>ixoff (-ixoff)</b><dd>Request that the system send (not send)STOP characters when the input queue is nearly full and STARTcharacters to resume data transmission.This has the effect of setting (not setting)IXOFFin the<b>termios</b><b>c_iflag</b>field, as defined in the <b>XBD</b> specification, <a href="../xbd/termios.html"><b>General Terminal Interface</b> </a> .</dl><h5><a name = "tag_001_014_2129_003"> </a>Output Modes</h5><dl compact><dt><b>opost (-opost)</b><dd>Post-process output (do not post-process output;ignore all other output modes).This has the effect of setting (not setting)OPOSTin the<b>termios</b><i>c_oflag</i>field, as defined in the <b>XBD</b> specification, <a href="../xbd/termios.html"><b>General Terminal Interface</b> </a> .<dt><b>olcuc (-olcuc)</b><dd>Map (do not map)lower-case alphabetics to upper-case on output.This has the effect of setting (not setting)OLCUCin the<b>termios</b><i>c_oflag</i>field, as defined in the <b>XBD</b> specification, <a href="../xbd/termios.html"><b>General Terminal Interface</b> </a> . (<b>LEGACY</b>)<dt><b>ocrnl (-ocrnl)</b><dd>Map (do not map) CR to NL on outputThis has the effect of setting (not setting)OCRNLin the<b>termios</b><i>c_oflag</i>field, as defined in the <b>XBD</b> specification, <a href="../xbd/termios.html"><b>General Terminal Interface</b> </a> .<dt><b>onocr (-onocr)</b><dd>Do not (do) output CR at column zero.This has the effect of setting (not setting) ONOCR in the<b>termios</b><i>c_oflag</i>field, as defined in the <b>XBD</b> specification, <a href="../xbd/termios.html"><b>General Terminal Interface</b> </a> .<dt><b>onlret (-onlret)</b><dd>The terminal newline key performs (does not perform) the CR function.This has the effect of setting (not setting) ONLRET in the<b>termios</b><i>c_oflag</i>field, as defined in the <b>XBD</b> specification, <a href="../xbd/termios.html"><b>General Terminal Interface</b> </a> .<dt><b>ofill (-ofill)</b><dd>Use fill characters (use timing) for delays.This has the effect of setting (not setting)OFILLin the<b>termios</b><i>c_oflag</i>field, as defined in the <b>XBD</b> specification, <a href="../xbd/termios.html"><b>General Terminal Interface</b> </a> .<dt><b>ofdel (-ofdel)</b><dd>Fill characters are DELs (NULs).This has the effect of setting (not setting) OFDEL in the<b>termios</b><i>c_oflag</i>field, as defined in the <b>XBD</b> specification, <a href="../xbd/termios.html"><b>General Terminal Interface</b> </a> .<dt><b>cr0 cr1 cr2 cr3</b><dd>Select the style of delay for CRs.This has the effect of setting (not setting) CRDLY toCR1, CR2, CR3 or CR4, respectively, in the<b>termios</b><i>c_oflag</i>field, as defined in the <b>XBD</b> specification, <a href="../xbd/termios.html"><b>General Terminal Interface</b> </a> .<dt><b>nl0 nl1</b><dd>Select the style of delay for NL.This has the effect of setting (not setting) NLDLY toNL0 or NL1, respectively, in the<b>termios</b><i>c_oflag</i>field, as defined in the <b>XBD</b> specification, <a href="../xbd/termios.html"><b>General Terminal Interface</b> </a> .<dt><b>tab0 tab1 tab2 tab3</b><dd>Select the style of delay for horizontal tabs.This has the effect of setting (not setting) TABDLY toTAB0, TAB1, TAB2 or TAB3, respectively, in the<b>termios</b><i>c_oflag</i>field, as defined in the <b>XBD</b> specification, <a href="../xbd/termios.html"><b>General Terminal Interface</b> </a> .Note that TAB3 has the effect of expanding tabs to spaces.<dt><b>bs0 bs1</b><dd>Select the style of delay for backspaces.This has the effect of setting (not setting)BSDLY to BS0 or BS1, respectively, in the<b>termios</b><i>c_oflag</i>field, as defined in the <b>XBD</b> specification, <a href="../xbd/termios.html"><b>General Terminal Interface</b> </a> .<dt><b>ff0 ff1</b><dd>Select the style of delay for form-feeds.This has the effect of setting (not setting)FFDLY to FF0 or FF1, respectively, in the<b>termios</b><i>c_oflag</i>field, as defined in the <b>XBD</b> specification, <a href="../xbd/termios.html"><b>General Terminal Interface</b> </a> .<dt><b>vt0 vt1</b><dd>Select the style of delay for vertical-tabs.This has the effect of setting (not setting)VTDLY to VT0 or VT1, respectively, in the<b>termios</b><i>c_oflag</i>field, as defined in the <b>XBD</b> specification, <a href="../xbd/termios.html"><b>General Terminal Interface</b> </a> .</dl><h5><a name = "tag_001_014_2129_004"> </a>Local Modes</h5><dl compact><dt><b>isig (-isig)</b><dd>Enable (disable) the checking of characters against the special controlcharactersINTR,QUIT,andSUSP.This has the effect of setting (not setting)ISIGin the<b>termios</b><b>c_lflag</b>field, as defined in the <b>XBD</b> specification, <a href="../xbd/termios.html"><b>General Terminal Interface</b> </a> .<dt><b>icanon (-icanon)</b><dd>Enable (disable) canonical input(ERASEandKILLprocessing).This has the effect of setting (not setting)ICANONin the<b>termios</b><b>c_lflag</b>field, as defined in the <b>XBD</b> specification, <a href="../xbd/termios.html"><b>General Terminal Interface</b> </a> .<dt><b>xcase (-xcase)</b><dd>Set canonical (unprocessed) upper- or lower-case presentation.This has the effect of setting (not setting)XCASEin the<b>termios</b><b>c_lflag</b>field, as defined in the <b>XBD</b> specification, <a href="../xbd/termios.html"><b>General Terminal Interface</b> </a> . (<b>LEGACY</b>)<dt><b>iexten (-iexten)</b><dd>Enable (disable) any implementation-dependent special control characters notcurrently controlled by<b>icanon</b>,<b>isig</b>,<b>ixon</b>or<b>ixoff</b>.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -