mgettydefs(4)
β¨ NAME β¨
mgettydefs β the speed + terminal settings that mgetty is obsessed with π
πΈ DESCRIPTION πΈ
okay bestie, so the /etc/gettydefs file is literally where all the info lives that mgetty(1) uses to set up the speed and terminal settings for a line. it ALSO tells you what the login prompt should look like. two jobs, no complaints π
a lot of UNIX versions ship a getty(1) that reads /etc/gettydefs too. both mgetty and getty want basically the same format in /etc/gettydefs, except that when mgetty is the one reading it, you get extended functionality β¨. and the cute part? standard getty just straight-up ignores those extra functions, so the two of them can share the same file in peace π«Ά. but heads up: mgetty can be compiled to use a file different from /etc/gettydefs if your getty gets all dramatic about the extensions. this manual page documents /etc/gettydefs and describes the extended functionality you get when it's used by mgetty(1). this doc says getty(1) everywhere except where mgetty's behaviour is different, iykyk.
every entry in /etc/gettydefs looks like this:
label# initial-flags # final-flags # login-prompt #next-label
and every entry is followed by a blank line, no skipping π
the login prompt field can contain quoted characters that get converted into other values. here are the sequences and what they turn into:
\nβ newline\rβ carriage return\gβ beep\bβ backspace\vβ vertical tab (VT)\fβ formfeed\tβ tab\Lβ portname\Cβ time inctime(3)format.\Nβ number of users currently logged in\Uβ number of users currently logged in\Dβ date in DD/MM format\Tβ time in hh:mm:ss format\Iβ modem CONNECT attributes\sequenceβ where "sequence" is a validstrtolformat, such as:\0nnn(octal),\0xnnn(hex), or\nnn(decimal).
lowkey important: standardgettyusually only supports\b,\rand\n. so don't go wild if you're sharing the file π
now the fields themselves, bestie:
π·οΈ label
this is the string that getty tries to match against its second argument. it's often the speed, like 1200, that the terminal is supposed to run at, but it does NOT have to be (see below). main character energy, your choice π
π© initial-flags
these flags are the initial ioctl(2) settings the terminal gets set to if a terminal type is not specified to getty. the flags getty understands are the ones listed in termio(7). mgetty is usually compiled for termios(7) and often has a more complete set than getty does. slay.
normally only the speed flag is required in the initial-flags. getty automatically sets the terminal to raw input mode and handles the other flags for you. if the -s option is used with mgetty(1) the speed setting is ignored. the initial-flag settings stay in effect until getty executes login(1).
π final-flags
these take the same values as the initial-flags and are set right before getty executes login. the speed flag is again required β except with mgetty, if the -s flag was supplied. two other commonly specified final-flags are TAB3, so tabs get sent to the terminal as spaces, and HUPCL, so the line is hung up on the final close. iconic behaviour fr.
π¬ login-prompt
this entire field gets printed as the login-prompt. unlike the above fields where white space (a space, tab or new-line) is ignored, here they ARE included in the login-prompt field. this field is ignored if the -p option has been specified to mgetty(1).
β‘οΈ next-label
this specifies the label to use if the user types a <break> character, or getty detects a reception error. getty searches for the entry with next-label as its label field and sets up the terminal for those settings. usually a series of speeds are linked together like this into a closed set β for instance, 2400 linked to 1200, which in turn is linked to 300, which finally is linked to 2400. next-label is ignored with mgetty(1).
there are several additional composite settings available for initial-flags and final-flags. these are supported by mgetty and usually supported by getty too:
SANEβ equivalent to ``stty sane''. (BRKINT,IGNPAR,ISTRIP,ICRNL,IXON,OPOST,CS8,CREAD,ISIG,ICANON,ECHO,ECHOK)ODDPβ Odd parity (CS7,PARENB,PARODD)PARITY,EVENPβ even parity (CS7,PARENB)-ODDP,-PARITY,-EVENPβ no parity (resetsPARENB,PARODD, and setsCS8)RAWβ raw I/O (no canonical processing) (turns offOPOST,ICANON)-RAW,COOKEDβ enable canonical processing (turns onOPOST,ICANON)NLβ Ignore newlines. (ICRNL,ONLCR)-NLβ Respect newlines (turnsINLCR,IGNCR,ICRNL,ONLCR,OCRNL,ONLREToff)LCASEβ Ignore case - treat all as lowercase. (IUCLC,OLCUC,XCASE) Is set ifmgettybelievesloginis entirely uppercase.-LCASEβ Repect case (turns offIUCLC,OLCUCandXCASE)TABSβ output tabs as tabs-TABS,TAB3β output tabs as spacesEKβ SetsVERASEto "#" andVKILLtoCKILLrespectively. (note that while many gettys defaultVERASEto "#",mgettydefaultsVERASEto backspace.)
and now the extra spicy part π«Ά β additionally, mgetty (but NOT getty) can set any of the control characters listed in the c_cc termio(termios) structure by using two tokens:
<character name> <value>
Eg:
VERASE ^h
the value can be set as ^<character>'', \nnn'' or ``<character>'' (normal UNIX \ escapes).
peep the termio(7) or termios(7) manual pages for a list of which ``V'' variables can be changed. note that many of these can be changed in the c_cc array, but won't have any effect. π
if getty is called without a second argument, the first entry of /etc/gettydefs is used by getty, which makes the first entry of /etc/gettydefs the default entry. it's also used if getty cannot find the specified label. Mgetty uses a default label of ``n'', but this can be changed in the configuration. and if /etc/gettydefs itself is missing? there's one entry built into the command which brings up a terminal at 300 (configuration parameter in mgetty) baud. built-in backup, we love to see it β¨
it is strongly recommended that after making or modifying/etc/gettydefs, you run it throughgettywith the check option to be sure there are no errors. no cap, just do it π
π¦ EXAMPLES π¦
the following two lines show an example of a 300/1200 baud toggle, which is useful for dial-up ports:
1200# B1200 HUPCL # B1200 SANE IXANY TAB3 #login: #300
300# B300 HUPCL # B300 SANE IXANY TAB3 #login: #1200
the following line shows a typical 9600 baud entry for a hard-wired connection (not currently supported for mgetty):
9600# B9600 # B9600 SANE IXANY IXANY ECHOE TAB3 #login: #9600
the following line is a typical smart-modem setup, suitable for mgetty:
19200mg#
B19200 #
B19200 SANE VERASE \b VINTR \003 HUPCL #
\n\D \T \N Users @!login: #19200mg
π FILES π
/etc/gettydefs
π SEE ALSO π
mgetty(8), getty(8), login(1), ioctl(2), termio(7), termios(7).
and that's the whole vibe check, bestie π this page is from the mgetty_sendfax manual, section 4, and it was written by greenie way back on 4 Dec 93 β like, ancient icon behaviour π mgettydefs(4) out, mwah π
π¦ where this page comes from
- debian bookworm: mgetty 1.2.1-1.2
- debian trixie: mgetty 1.2.1-2 Β· GPL-2.0-or-later
- opensuse-leap 16.0: mgetty 1.2.1-bp160.1.13 Β· GPL-2.0-or-later
- opensuse-leap 16.0: mgetty 1.2.1-bp160.1.13 Β· GPL-2.0-or-later
- opensuse-leap 16.0: mgetty 1.2.1-bp160.1.13 Β· GPL-2.0-or-later
- opensuse-leap 16.0: mgetty 1.2.1-bp160.1.13 Β· GPL-2.0-or-later
- ubuntu jammy: mgetty 1.2.1-1.1
- ubuntu noble: mgetty 1.2.1-1.2
- ubuntu questing: mgetty 1.2.1-3
- ubuntu resolute: mgetty 1.2.1-5 Β· GPL-2.0-or-later
- ubuntu stonking: mgetty 1.2.1-8 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms