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 > G


HP-UX 11i Version 3: February 2007

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index


getty — set terminal type, modes, speed, and line discipline


/usr/sbin/getty [-f] [-h] [-t timeout] line [speed [type [linedesc]]]

/usr/sbin/getty -c file


The getty program is invoked by init (see init(1M)), as the second process in the series, init > getty > login > shell, that ultimately connects a user with the HP-UX system.

getty sets the terminal speed and characteristics and prompts for the user's login information before passing control to the login program. See Operation below for details.


getty recognizes the following options:

-c file

Scan and test file for conformance with the specifications in the gettydefs(4) manpage, print the results on standard output, and terminate. All other arguments are ignored.

Any unrecognized modes or improperly constructed entries are reported as errors. For correct entries, getty prints out the values of the various flags. See ioctl(2) for an interpretation of values. Note that some values are added to the flags automatically.


Get the settings for special control characters from the /dev/ttyconf file. See the Special Control Characters section.


Do not force a hangup on the line before setting the speed.

By default, getty forces a hangup on the line by setting the speed to zero before setting the speed to the default or specified speed. However, when getty is run on a direct port, getty does not force a hangup on the line since the driver ignores changes to zero speed on ports open in direct mode (see modem(7)).

-t timeout

Exit if the open on the line succeeds and no one types anything within timeout seconds. The default is to wait indefinitely.


getty recognizes the following operands:


The name of a tty device file in /dev to which getty is to attach itself. getty opens file /dev/line for reading and writing.


A label for a speed and tty definition in the file /etc/gettydefs. See gettydefs(4).

This definition tells getty at what speed to run initially, what the login message should look like, what the initial tty settings are, and what speed to try next if the user indicates that the speed is inappropriate by typing a break character. The default speed is the first entry in /etc/gettydefs, or 300 baud if /etc/gettydefs is missing or unusable.


A character string describing what type of terminal is connected to the line in question. getty understands the following types:

c100Concept 100
hp45Hewlett-Packard HP2645
vt61DEC vt61
vt100DEC vt100

The default terminal is none, that is, any CRT or normal terminal unknown to the system. Also, for terminal type to have any meaning, the virtual terminal handlers must be compiled into the operating system. They are available, but not compiled, in the default condition.


A character string describing which line discipline to use when communicating with the terminal. Hooks for line disciplines are available in the operating system, but there is only one presently available: the default line discipline, LDISC0.


Testing /etc/gettydefs

With the -c option, getty tests file against the rules for /etc/gettydefs (see gettydefs(4)), prints error messages and flag values to standard output, and terminates.

This is a good way to test a revised /etc/gettydefs file before putting it into operation.

Normal Execution

Without the -c option, getty opens the port interface for line, sets the speed, terminal parameters, and login message, prompts for login information, and passes control to the login program, as follows.


getty determines the speed, terminal parameters, and login message.

  • If the speed operand is given, getty selects that entry from /etc/gettydefs and sets the terminal parameters and login message to the given values.

  • If speed is not found in /etc/gettydefs or the speed operand is omitted, getty selects the first entry from /etc/gettydefs and sets the terminal parameters and login message to the given values.

  • If /etc/gettydefs is missing or unreadable or has errors, getty sets the speed of the interface to 300 baud, sets the login message to LOGIN:, and sets the terminal parameters to: use raw mode (awaken on every character), suppress echo, allow either parity, convert newline characters to carriage-return-linefeed, and perform tab expansion on standard output,

  • If type or linedesc is given, the terminal parameters are adjusted appropriately.

  • The special control characters are defined. If the -f option is given, they are read from the /dev/ttyconf file. See the Special Control Characters section for detail.

  • getty connects to the terminal port, applying all the terminal parameters. It forces a hangup on the line by setting the speed to zero, except if the port is opened in direct mode or if the -h option was specified.


getty prompts for and reads a line of login information.

  • If the /etc/issue file exists, it is displayed.

  • The login message is displayed.

  • getty reads the user name and optional arguments from the port. The one-line parsed input is limited to 255 characters and 64 whitespace-delimited words. The special control characters affect the input. See the Special Control Characters section for detail.

    If a null character or a framing error is received, it is assumed to be the result of the user pushing the break key. This causes getty to attempt the next speed in the current /etc/gettydefs series, repeating step 1.

    The input line is terminated with a newline or carriage return character. If the latter, the system is set to receive carriage returns appropriately (see termio(7)).

    The user's name is scanned to see if it contains any lowercase alphabetic characters. If it does not, and if the name is nonempty, the system is told to map any future uppercase characters into the corresponding lowercase characters.


getty passes control to login.

  • getty passes the parsed user name and optional arguments, along with the terminal parameters, to the login program (see exec(2)).

  • login performs user validation (for example, password processing) and login retries, places the optional arguments in environment variables, and passes control to the shell. See login(1) for details.


On termination, control returns to init.

  • When getty, or login, or the shell terminate for any reason, control reverts to init.

  • If the respawn action is defined for the device file in /etc/inittab, init reruns the getty command, and the process resumes at step 1 (see inittab(4)).

Special Control Characters

The getty program uses special control characters to manage text input and to switch line speeds.

The default special control characters are shown in the following table.

Table 1: Default Special Control Characters

 May BeCharacter, or ASCII Value
NameQuoted (ASCII Name; Key Names)Action
eofYes^D(EOT)Terminate getty
eraseYes# Erase previous character
intrNo127(DEL; Delete)Erase entire input line
killYes@ Erase entire input line
quitNo^\(FS)Terminate getty
breakNo\0(NUL or framing error)Switch to next entry
lineendNo^J(NL; newline)Terminate input line
lineendNo^M(CR; carriage return)Terminate input line
quoteYes\ Quote next character

Changing Control Character Values

You can set different values for eof, erase, intr, kill, quit, and some other terminal parameters by modifying the /dev/ttyconf file. A superuser may view and modify /dev/ttyconf with the stty command. See stty(1) for details.

To use the values in /dev/ttyconf, specify the -f option on the getty command line.


getty understands the single character quoting convention using the backslash (\) quote. This allows you to include whitespace, some of the special control characters, and some of the general control characters, in the input line as ordinary text. You cannot quote the current values of the special control character names that are marked "No" in the May Be Quoted column. The single and double quotation marks (' and " ) have no special meaning (unless they are assigned in /dev/ttyconf).


HP2334 MultiMux

The modem control parameter MRTS must be present in the /etc/gettydefs file when using getty in conjunction with an HP2334 or HP2335 MultiMux to ensure that the RTS modem control signal is asserted correctly.


9600 # B9600 HUPCL PARENB MRTS # B9600 SANE PARENB ISTRIP IXANY #login: #19200

MRTS is not intended for use with devices other than the HP2334 or HP2335 MultiMux.


/dev/ttyconf /etc/gettydefs /etc/issue

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