Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > S


HP-UX 11i Version 3: February 2007

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index


stty — set the options for a terminal port


stty [-a|-g|options]


stty sets or reports current settings of certain terminal I/O options for the device that is the current standard input. The command takes four forms:


Report the settings of a system-defined set of options;

stty -a

Report all of current option settings;

stty -g

Report current settings in a form that can be used as an argument to another stty command.

stty options

Set terminal I/O options as defined by options.

For detailed information about the modes listed below in Control Modes, Input Modes, Output Modes, and Local Modes, as they relate to asynchronous lines, see termio(7).

For detailed information about the modes listed below in Hardware Flow Control Modes, see termiox(7).

Options in the Combination Modes group are implemented using options in the previous groups. Note that many combinations of options make no sense, but no sanity checking is performed.

The options are defined in the following groups.

Control Modes

rows number

Set the terminal window row size equal to number.

columns number

Set the terminal window column size (width) equal to number. cols can be used as an abbreviation for columns.

parenb (-parenb)

Enable (disable) parity generation and detection.

parodd (-parodd)

Select odd (even) parity.

cs5 cs6 cs7 cs8

Select character size (see termio(7)).


Hang up phone line immediately.

50 75 110 134.5 150 200 300 600 900 1200 1800 2400

3600 4800 7200 9600 19200 38400 57600 115200 230400 exta extb

Set terminal baud rate to the number given, if possible (some hardware interfaces do not support all of the speeds listed here). Speeds above 38400 are supported on Series 700 only.

ispeed number

Set terminal input baud rate to number. If number is zero, the input baud rate is set to the value of the output baud rate.

ospeed number

Set terminal output baud rate to number. If number is zero, the modem control lines are released, which in turn disconnects the line.

hupcl (-hupcl)

Hang up (do not hang up) modem connection on last close.

hup (-hup)

Same as hupcl (-hupcl).

cstopb (-cstopb)

Use two (one) stop bits per character.

cread (-cread)

Enable (disable) the receiver.

crts (-crts)

Enable (disable) request-to-send.

clocal (-clocal)

Assume a line without (with) modem control.

loblk (-loblk)

Block (do not block) output from a noncurrent layer.


Reset the Guardian Service Processor (GSP) of the console. This mode can be used only by the superuser. This is supported only on specific hardware.

Input Modes

ignbrk (-ignbrk)

Ignore (do not ignore) break on input.

ienqak (-ienqak)

Enable (disable) ENQ-ACK Handshaking.

brkint (-brkint)

Signal (do not signal) INTR on break.

ignpar (-ignpar)

Ignore (do not ignore) parity errors.

parmrk (-parmrk)

Mark (do not mark) parity errors (see termio(7)).

inpck (-inpck)

Enable (disable) input parity checking.

istrip (-istrip)

Strip (do not strip) input characters to seven bits.

inlcr (-inlcr)

Map (do not map) newline character to carriage return (CR) on input.

igncr (-igncr)

Ignore (do not ignore) CR on input.

icrnl (-icrnl)

Map (do not map) CR to a newline character on input.

iuclc (-iuclc)

Map (do not map) uppercase alphabetic characters to lowercase on input.

ixon (-ixon)

Enable (disable) START/STOP output control. Output is stopped by sending an ASCII DC3 and started by sending an ASCII DC1.

ixany (-ixany)

Allow any character (only DC1) to restart output.

ixoff (-ixoff)

Request that the system send (not send) START/STOP characters when the input queue is nearly empty/full.

imaxbel (-imaxbel)

Echo (do not echo) BEL when the input line is too long.

Output Modes

opost (-opost)

Post-process output (do not post-process output; ignore all other output modes).

olcuc (-olcuc)

Map (do not map) lowercase alphabetics to uppercase on output.

onlcr (-onlcr)

Map (do not map) newline character to a carriage-return/newline character sequence on output.

ocrnl (-ocrnl)

Map (do not map) CR to newline character on output.

onocr (-onocr)

Do not (do) output CRs at column zero.

onlret (-onlret)

On the terminal, a newline character performs (does not perform) the CR function.

ofill (-ofill)

Use fill characters (use timing) for delays.

ofdel (-ofdel)

Fill characters are DELs ( NULs).

cr0 cr1 cr2 cr3

Select style of delay for carriage returns (see termio(7)).

nl0 nl1

Select style of delay for newline characters (see termio(7)).

tab0 tab1 tab2 tab3

Select style of delay for horizontal tabs (see termio(7).

bs0 bs1

Select style of delay for backspaces (see termio(7)).

ff0 ff1

Select style of delay for form-feeds (see termio(7)).

vt0 vt1

Select style of delay for vertical tabs (see termio(7)).

Local Modes

isig (-isig)

Enable (disable) the checking of characters against the special control characters INTR and QUIT.

icanon (-icanon)

Enable (disable) canonical input (ERASE and KILL processing).

iexten (-iexten)

Enable (disable) any implementation-defined special control characters not currently controlled by icanon, isig, or ixon.

xcase (-xcase)

Canonical (unprocessed) uppercase and lowercase presentation.

echo (-echo)

Echo back (do not echo back) every character typed.

echoe (-echoe)

Echo (do not echo) ERASE character as a backspace-space-backspace string. Note: this mode erases the ERASEed character on many CRT terminals. However, it does not keep track of column position and, as a result, may not correctly erase escaped characters, tabs, and backspaces.

echok (-echok)

Echo (do not echo) a newline character after a KILL character.

lfkc (-lfkc)

(obsolete) Same as echok (-echok).

echonl (-echonl)

Echo (do not echo) newline character.

noflsh (-noflsh)

Disable (enable) flush after INTR or QUIT.

echoctl (-echoctl)

Echo (do not echo) control characters as ^char, delete as ^?.

echoprt (-echoprt)

Echo (do not echo) erase character as character is erased.

echoke (-echoke)

BS-SP-BS erase (do not BS-SP-BS erase) entire line on line kill.

flusho (-flusho)

Output is (is not) being flushed.

pendin (-pendin)

Retype (do not retype) pending output at next read or input character.

tostop (-tostop)

Enable (disable) generation of SIGTTOU signals when background jobs attempt output.

Hardware Flow Control Modes

The following options are reserved for use with those devices that support hardware flow control through the termiox interface. If the functionality is supported, this interface must be used.

rtsxoff (-rtsxoff)

Enable (disable) RTS hardware flow control on input (see termiox(7))

ctsxon (-ctsxon)

Enable (disable) CTS hardware flow control on output (see termiox(7))

Control Assignments

control-character c

Set control-character to character c. See termio(7).


One of:

erase, kill, intr, quit, eof, eol, eol2, werase, lnext, min, or time. (min and time are used with -icanon.)

susp or dsusp, for systems that support job control.

swtch, for systems that support shell layers (see shl(1)).


A character or a character-pair. A character-pair is made up of a circumflex (^) and a letter or symbol; it represents the value of the corresponding control character. For example,

^@ represents NUL.

^D or ^d represents Ctrl-D or EOT.

^? represents DEL.

^- sets control-character to undefined.

Some characters may need to be escaped from the shell (quoted).

line i

Set line discipline to i where the value of i ranges from zero through 127 decimal (See termio(7)).

Combination Modes

evenp or parity

Enable parenb and cs7.


Enable parenb, cs7, and parodd.

-parity, -evenp, or -oddp

Disable parenb and set cs8.

raw (-raw or cooked)

Enable (disable) raw input and output (no ERASE, KILL, INTR, QUIT, EOT, or output post processing). See WARNINGS.

nl (-nl)

Unset (set) icrnl and onlcr . In addition -nl unsets inlcr, igncr, ocrnl, and onlret.

lcase (-lcase)

Set (unset) xcase, iuclc, and olcuc.


Same as lcase (-lcase).

tabs (-tabs or tab3)

Preserve (expand to spaces) tabs when printing.


Reset ERASE and KILL characters back to default # and @.


Reset all modes to some reasonable values.


Set all modes suitable for the terminal type term, where term is one of tty33, tty37, vt05, tn300, ti700, hp, or tek.

Reporting Functions


Print terminal window size to standard output in a rows-and-columns format.


Print the status of the Guardian Service Processor (GSP) of the console. This function can be used only by the superuser. This feature is available only on specific hardware.

Control Character Default Assignments

The control characters are assigned default values when the terminal port is opened; see termio(7). The default values used are those specified by the System V Interface Definition, Third Edition (SVID3), except for the werase and lnext control characters, which are set to _POSIX_VDISABLE to maintain binary compatibility with previous releases of HP-UX.

The default values for the control characters may be changed by a privileged user by using stty and redirecting standard input to the device /dev/ttyconf. Any of the four command forms specified in the DESCRIPTION section above may be used. However, only the control character defaults will be reported or altered. It will have no effect on the defaults for any of the other modes.

Note that these defaults will be used for all terminal ports in the system, except the system console (but see getty(1M)), and the changes will not become effective for a particular port until it is (re)opened. The default control character assignment will not work with the system console because the system console is never closed while the system is running, and therefore cannot be reopened.

Care should be exercised when re-assigning the control character defaults. Control character values should be tested with applications before assigning them as a default value.


Environment Variables

LC_CTYPE determines the valid control characters for printing.

If LC_CTYPE is not specified in the environment or is set to the empty string, the value of LANG is used as a default for each unspecified or empty variable. If LANG is not specified or is set to the empty string, a default of "C" (see lang(5)) is used instead of LANG. If any internationalization variable contains an invalid setting, stty behaves as if all internationalization variables are set to "C". See environ(5).

International Code Set Support

Single-byte character code sets are supported.


Example 1

Set the delete-line character to ^X (Ctrl-X) and the interrupt character to ^C.

stty kill '^X' intr '^C'

This command is usually found in a .login or .profile file so that ^X and ^C need not be set by the user at each login session.

Example 2

Set the default values for the delete-line character to ^X (Ctrl-X), the interrupt character to ^C, and the word erase character to ^W.

stty kill '^X' intr '^C' werase '^W' </dev/ttyconf

Any terminal port opened after this command is issued will see these new default values for the kill, intr, and werase control characters.


Use of raw mode produces certain side effects which have varied from release to release in the past and may vary in the future. Relying on these side effects in applications can lead to unreliable results in the future and is therefore discouraged.


Refer to the DEPENDENCIES section of termio(7) for a further description of capabilities that are not supported.


stty: SVID2, SVID3, XPG2, XPG3, XPG4, POSIX.2

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.