AGETTY(8)

๐Ÿ’– AGETTY โ€” the agetty(8) glow-up ๐Ÿ’–

okay bestie, sit down, grab a strawberry drink, because we're about to talk about agetty โ€” the alternative Linux getty โ€” and she is honestly kind of iconic for a program that mostly just... sits on a serial line and waits. โœจ


๐ŸŒธ NAME ๐ŸŒธ

agetty โ€” alternative Linux getty. That's her. That's the name. Short, sweet, does exactly what it says on the tin. ๐Ÿ’…


โœจ SYNOPSIS โœจ

agetty [options] port [baud_rate...] [term]

yes, that's it, that's the whole vibe. options, then a port, then optionally some baud rates, then optionally a term. we love a compact signature. ๐ŸŽ€


๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

So. agetty opens a tty port, prompts for a login name, and then invokes the /bin/login command. She's normally invoked by init(8) โ€” like, she doesn't just show up on her own, she gets called in by the big boss. ๐Ÿ‘‘

And she has several non-standard features that are genuinely useful for hardwired lines and for dial-in lines. Non-standard!! She's not like other gettys. ๐Ÿ’…

  • She adapts the tty settings to parity bits and to erase, kill, end-of-line and uppercase characters when she reads a login name. The program can handle 7-bit characters with even, odd, none or space parity, and 8-bit characters with no parity. The following special characters are recognized: Control-U (kill); DEL and backspace (erase); carriage return and line feed (end of line). See also the --erase-chars and --kill-chars options. (iykyk ๐Ÿซถ)
  • She can optionally deduce the baud rate from the CONNECT messages produced by Hayes(tm)-compatible modems. Modem girlie behaviour, honestly.
  • She can optionally not hang up when she's given an already opened line โ€” which is useful for call-back applications. Stay on the line, babe, we're not done here.
  • She can optionally not display the contents of the /etc/issue file. Sometimes you just don't wanna show the group chat the whole message, y'know?
  • She can optionally display alternative issue files or directories instead of /etc/issue or /etc/issue.d. โœจ choices โœจ
  • She can optionally not ask for a login name at all. No questions, no talking, just vibes.
  • She can optionally invoke a non-standard login program instead of /bin/login. Main character energy: she's not locked into one bestie.
  • She can optionally turn on hardware flow control. ๐ŸŒŠ
  • She can optionally force the line to be local, with no need for carrier detect. Homebody mode: no need for outside approval.
๐Ÿ’€ Heads up bestie: this program does not use the /etc/gettydefs (System V) or /etc/gettytab (SunOS 4) files. Not those files. Never those files. Periodt.

๐ŸŽ€ ARGUMENTS ๐ŸŽ€

๐ŸŒˆ port

A path name relative to the /dev directory.

If a - is specified, agetty assumes that its standard input is already connected to a tty port and that a connection to a remote user has already been established. (she just trusts you like that ๐Ÿซถ)

Under System V, a - port argument should be preceded by a --. Don't forget it, bestie, or things get weird.

โญ baud_rate,...

A comma-separated list of one or more baud rates. Every time agetty receives a BREAK character, she advances through the list โ€” and the list is treated as if it were circular. ๐Ÿ”„ Endless loop, but make it baud rates.

Baud rates should be specified in descending order, so that the null character (Ctrl-@) can also be used for baud-rate switching. Descending!! She said descending!!! ๐Ÿ’…

This argument is optional and unnecessary for virtual terminals. Virtual terminal girlies, you can sit this one out.

The default for serial terminals is to keep the current baud rate (see --keep-baud) and if unsuccessful then default to 9600.


๐Ÿฆ‹ term

The value to be used for the TERM environment variable. This overrides whatever init(1) may have set, and is inherited by login and the shell. it's giving generational inheritance, honestly ๐ŸŒธ

The default is vt100, or linux for Linux on a virtual terminal, or hurd for GNU Hurd on a virtual terminal.

Three defaults, three vibes, pick your fighter. โœจ


okay that's part one bestie, don't go anywhere ๐Ÿ’–

โœจ OPTIONS โœจ

okay bestie, here's the whole menu, every single flag, no skips ๐Ÿ’…

  • -8, --8bits โ€” assume the tty is 8-bit clean, so parity detection gets switched off. bye parity ๐Ÿ‘‹
  • -a, --autologin _username_ โ€” auto-log in the specified user, no username or password prompt at all. Using this option causes an -f username option and argument to be added to the /bin/login command line. See --login-options, which can be used to modify this option's behavior.
heads up: --autologin may affect the way in which getty initializes the serial line, because on auto-login agetty does not read from the line and it has no opportunity optimize the line setting. ๐Ÿ˜ฌ
  • -c, --noreset โ€” don't reset terminal cflags (control modes). See termios(3) for more details.
  • -E, --remote โ€” typically the login(1) command is given a remote hostname when called by something such as telnetd(8). This option allows agetty to pass what it is using for a hostname to login(1) for use in utmp(5). See --host, login(1), and utmp(5).

If the --host _fakehost_ option is given, then an -h _fakehost_ option and argument are added to the /bin/login command line.

If the --nohostname option is given, then an -H option is added to the /bin/login command line.

See --login-options.

  • -f, --issue-file _path_ โ€” specifies a ":" delimited list of files and directories to be displayed instead of /etc/issue (or other). All specified files and directories are displayed, missing or empty files are silently ignored. If the specified _path_ is a directory then display all files with .issue file extension in version-sort order from the directory. This allows custom messages to be displayed on different terminals. The --noissue option will override this option. ๐Ÿ—‚๏ธ
  • --show-issue โ€” display the current issue file (or other) on the current terminal and exit. Use this option to review the current setting, it is not designed for any other purpose. Note that output may use some default or incomplete information as proper output depends on terminal and agetty command line. ๐Ÿ‘€
  • -h, --flow-control โ€” enable hardware (RTS/CTS) flow control. It is left up to the application to disable software (XON/XOFF) flow protocol where appropriate.
  • -H, --host _fakehost_ โ€” write the specified _fakehost_ into the utmp file. Normally, no login host is given, since agetty is used for local hardwired connections and consoles. However, this option can be useful for identifying terminal concentrators and the like.
  • -i, --noissue โ€” do not display the contents of /etc/issue (or other) before writing the login prompt. Terminals or communications hardware may become confused when receiving lots of text at the wrong baud rate; dial-up scripts may fail if the login prompt is preceded by too much text. ๐Ÿšซ๐Ÿ“œ
  • -I, --init-string _initstring_ โ€” set an initial string to be sent to the tty or modem before sending anything else. This may be used to initialize a modem. Non-printable characters may be sent by writing their octal code preceded by a backslash (\). For example, to send a linefeed character (ASCII 10, octal 012), write \12.
  • -J, --noclear โ€” do not clear the screen before prompting for the login name. By default the screen is cleared.
  • -l, --login-program _login_program_ โ€” invoke the specified _login_program_ instead of /bin/login. This allows the use of a non-standard login program. Such a program could, for example, ask for a dial-up password or use a different password file. See --login-options.
  • -L, --local-line[=mode] โ€” control the CLOCAL line flag. The optional _mode_ argument is auto, always or never. If the _mode_ argument is omitted, then the default is always. If the --local-line option is not given at all, then the default is auto.
    • always โ€” forces the line to be a local line with no need for carrier detect. This can be useful when you have a locally attached terminal where the serial line does not set the carrier-detect signal.
    • never โ€” explicitly clears the CLOCAL flag from the line setting and the carrier-detect signal is expected on the line.
    • auto โ€” the agetty default. Does not modify the CLOCAL setting and follows the setting enabled by the kernel.
  • -m, --extract-baud โ€” try to extract the baud rate from the CONNECT status message produced by Hayes(tm)-compatible modems. These status messages are of the form: "<junk><speed><junk>". agetty assumes that the modem emits its status message at the same speed as specified with (the first) _baud_rate_ value on the command line.
since the --extract-baud feature may fail on heavily-loaded systems, you still should enable BREAK processing by enumerating all expected baud rates on the command line. ๐Ÿ˜ค
  • --list-speeds โ€” display supported baud rates. These are determined at compilation time.
  • -n, --skip-login โ€” do not prompt the user for a login name. This can be used in connection with the --login-program option to invoke a non-standard login process such as a BBS system. Note that with the --skip-login option, agetty gets no input from the user who logs in and therefore will not be able to figure out parity, character size, and newline processing of the connection. It defaults to space parity, 7 bit characters, and ASCII CR (13) end-of-line character. Beware that the program that agetty starts (usually /bin/login) is run as root. ๐Ÿ”ฅ
  • -N, --nonewline โ€” do not print a newline before writing out /etc/issue.
  • -o, --login-options _login_options_ โ€” options and arguments that are passed to login(1). Where \u is replaced by the login name. For example:
--login-options '-h darkstar -- \u'

See --autologin, --login-program and --remote.

bestie please read the SECURITY NOTICE below before using this option. seriously. ๐Ÿ™
  • -p, --login-pause โ€” wait for any key before dropping to the login prompt. Can be combined with --autologin to save memory by lazily spawning shells.
  • -r, --chroot _directory_ โ€” change root to the specified _directory_.
  • -R, --hangup โ€” call vhangup(2) to do a virtual hangup of the specified terminal.
  • -s, --keep-baud โ€” try to keep the existing baud rate. The baud rates from the command line are used when agetty receives a BREAK character. If another baud rates specified then the original baud rate is also saved to the end of the wanted baud rates list. This can be used to return to the original baud rate after unexpected BREAKs.
  • -t, --timeout _timeout_ โ€” terminate if no user name could be read within _timeout_ seconds. Use of this option with hardwired terminal lines is not recommended. โฐ
  • -U, --detect-case โ€” turn on support for detecting an uppercase-only terminal. This setting will detect a login name containing only capitals as indicating an uppercase-only terminal and turn on some upper-to-lower case conversions. Note that this has no support for any Unicode characters.
  • -w, --wait-cr โ€” wait for the user or the modem to send a carriage-return or a linefeed character before sending the /etc/issue file (or others) and the login prompt. This is useful with the --init-string option.
  • --nohints โ€” do not print hints about Num, Caps and Scroll Locks.
  • --nohostname โ€” by default the hostname will be printed. With this option enabled, no hostname at all will be shown. This setting is also possible to able by LOGIN_PLAIN_PROMPT option in the /etc/login.defs configuration file (see below for more details).
  • --long-hostname โ€” by default the hostname is only printed until the first dot. With this option enabled, the fully qualified hostname by gethostname(3P) or (if not found) by getaddrinfo(3) is shown.
  • --erase-chars _string_ โ€” this option specifies additional characters that should be interpreted as a backspace ("ignore the previous character") when the user types the login name. The default additional 'erase' has been '#', but since util-linux 2.23 no additional erase characters are enabled by default.
  • --kill-chars _string_ โ€” this option specifies additional characters that should be interpreted as a kill ("ignore all previous characters") when the user types the login name. The default additional 'kill' has been '@', but since util-linux 2.23 no additional kill characters are enabled by default.
  • --chdir _directory_ โ€” change directory before the login.
  • --delay _number_ โ€” sleep _number_ seconds before open tty.
  • --nice _number_ โ€” run login with this priority.
  • --reload โ€” ask all running agetty instances to reload and update their displayed prompts, if the user has not yet commenced logging in. After doing so the command will exit. This feature might be unsupported on systems without Linux inotify(7). ๐Ÿ”„
  • --help โ€” display help text and exit.
  • --version โ€” display version and exit.

๐ŸŽ€ CONFIG FILE ITEMS ๐ŸŽ€

agetty reads the /etc/login.defs configuration file (see login.defs(5)). Note that the configuration file could be distributed with another package (usually shadow-utils). The following configuration items are relevant for agetty:

LOGIN_PLAIN_PROMPT (boolean)

Tell agetty that printing the hostname should be suppressed in the login: prompt. This is an alternative to the --nohostname command line option. The default value is no.


๐ŸŒธ EXAMPLE ๐ŸŒธ

This section shows examples for the process field of an entry in the /etc/inittab file. You'll have to prepend appropriate values for the other fields. See inittab(5) for more details.

For a hardwired line or a console tty:

/sbin/agetty 9600 ttyS1

For a directly connected terminal without proper carrier-detect wiring (try this if your terminal just sleeps instead of giving you a password: prompt):

/sbin/agetty --local-line 9600 ttyS1 vt100

For an old-style dial-in line with a 9600/2400/1200 baud modem:

/sbin/agetty --extract-baud --timeout 60 ttyS1 9600,2400,1200

For a Hayes modem with a fixed 115200 bps interface to the machine (the example init string turns off modem echo and result codes, makes modem/computer DCD track modem/modem DCD, makes a DTR drop cause a disconnection, and turns on auto-answer after 1 ring):

/sbin/agetty --wait-cr --init-string 'ATE0Q1&D2&C1S0=1\015'
115200 ttyS1

๐Ÿ” SECURITY NOTICE ๐Ÿ”

okay bestie, listen up because this one is important. if you're using the --login-program and --login-options options, you need to know that a malicious user might try to sneak lognames in with embedded options inside them, and those get passed straight to the login program you picked. agetty does check for a leading - and makes sure the logname gets passed as one single parameter (so embedded spaces won't spawn a whole extra parameter), but depending on how your login binary parses the command line, that might not be enough. so pls, check that the login program you're using can't be abused this way. ๐Ÿซถ

some programs use -- to say "hey, the rest of the command line is NOT options, don't interpret it". use that feature if it's available by passing -- before the username gets passed by \u. ๐Ÿ’…


๐Ÿ“œ ISSUE FILES ๐Ÿ“œ

the default issue file is /etc/issue. if that file exists, agetty also checks for the /etc/issue.d directory. that directory is an optional extension to the default issue file, and its content gets printed after the /etc/issue content. if /etc/issue does not exist, then the directory is ignored, periodt. all files with the .issue extension from the directory are printed in version-sort order. the directory can be used to maintain 3rd-party messages independently from the primary system /etc/issue file. โœจ

since version 2.35, additional locations for the issue file and directory are supported. agetty checks for the files /run/issue and /run/issue.d, and then for /usr/lib/issue and /usr/lib/issue.d. the directory /etc is expected for host-specific configuration, /run is expected for generated content, and /usr/lib is used for static configuration maintained by the distribution. ๐ŸŒธ

note that in versions 2.35 to 2.40, the additional locations were only read if the default /etc/issue file did not exist. however, since version 2.41, the additional locations are always read, regardless of the existence of the /etc/issue file. this change allows for the generation of issue files by default. ๐Ÿ’–

the default paths may be completely overridden by the --issue-file option. in this case the specified path has to be a file or a directory, and all the default issue file and directory locations are ignored. ๐Ÿ™ˆ

the issue file feature can be completely disabled by the --noissue option.

it is possible to review the current issue file by agetty --show-issue on the current terminal. ๐Ÿ‘‘

the issue files may contain certain escape codes to display the system name, date, time et cetera. all escape codes consist of a backslash (\) immediately followed by one of the characters listed below. ๐Ÿฆ‹

  • \4 or \4{interface} โ€” insert the IPv4 address of the specified network interface (for example: \4{eth0}). if the interface argument is not specified, then select the first fully configured (UP, non-LOCALBACK, RUNNING) interface. if no configured interface is found, fall back to the IP address of the machine's hostname.
  • \6 or \6{interface} โ€” the same as \4 but for IPv6.
  • \a โ€” insert list of "good" IP addresses for all interfaces. it prints best candidates for remote login IP addresses: global and site addresses; if not available, temporary address with the longest lifetime, if not available, link address. note that link addresses are printed with local interface name, but they has to be done with the interface name on the machine where they will be used.
  • \A โ€” insert list of all IP addresses for all interfaces.
  • \b โ€” insert the baudrate of the current line.
  • \d โ€” insert the current date.
  • \e or \e{name} โ€” translate the human-readable name to an escape sequence and insert it (for example: \e{red}Alert text.\e{reset}). if the name argument is not specified, then insert \033. the currently supported names are: black, blink, blue, bold, brown, cyan, darkgray, gray, green, halfbright, lightblue, lightcyan, lightgray, lightgreen, lightmagenta, lightred, magenta, red, reset, reverse, yellow and white. all unknown names are silently ignored. ๐Ÿ’€
  • \s โ€” insert the system name (the name of the operating system). same as uname -s. see also the \S escape code.
  • \S or \S{VARIABLE} โ€” insert the VARIABLE data from /etc/os-release. if this file does not exist then fall back to /usr/lib/os-release. if the VARIABLE argument is not specified, then use PRETTY_NAME from the file or the system name (see \s). this escape code can be used to keep /etc/issue distribution and release independent. note that \S{ANSI_COLOR} is converted to the real terminal escape sequence.
  • \l โ€” insert the name of the current tty line.
  • \m โ€” insert the architecture identifier of the machine. same as uname -m.
  • \n โ€” insert the nodename of the machine, also known as the hostname. same as uname -n.
  • \o โ€” insert the NIS domainname of the machine. same as hostname -d.
  • \O โ€” insert the DNS domainname of the machine.
  • \r โ€” insert the release number of the OS. same as uname -r.
  • \t โ€” insert the current time.
  • \u โ€” insert the number of current users logged in.
  • \U โ€” insert the string 1 user or <n> users where <n> is the number of current users logged in.
  • \v โ€” insert the version of the OS, that is, the build-date and such.

an example, bestie. on my system, the following /etc/issue file:

This is \n.\o (\s \m \r) \t

displays as:

This is thingol.orcan.dk (Linux i386 1.1.9) 18:29:30

literally so cute. ๐ŸŒˆ


๐Ÿ“‚ FILES ๐Ÿ“‚

  • /var/run/utmp โ€” the system status file.
  • /etc/issue โ€” printed before the login prompt.
  • /etc/os-release /usr/lib/os-release โ€” operating system identification data.
  • /dev/console โ€” problem reports (if syslog(3) is not used).
  • /etc/inittab โ€” init(8) configuration file for SysV-style init daemon.

๐ŸŽ€ CREDENTIALS ๐ŸŽ€

agetty supports configuration via systemd credentials (see https://systemd.io/CREDENTIALS/). agetty reads the following systemd credentials:

  • agetty.autologin (string) โ€” if set, configures agetty to automatically log in the specified user without asking for a username or password, similarly to the --autologin option.

๐Ÿ› BUGS ๐Ÿ›

the baud-rate detection feature (the --extract-baud option) requires that agetty be scheduled soon enough after completion of a dial-in call (within 30 ms with modems that talk at 2400 baud). for robustness, always use the --extract-baud option in combination with a multiple baud rate command-line argument, so that BREAK processing is enabled. ๐Ÿ˜ญ

the text in the /etc/issue file (or other) and the login prompt are always output with 7-bit characters and space parity.

the baud-rate detection feature (the --extract-baud option) requires that the modem emits its status message after raising the DCD line.


๐Ÿฉบ DIAGNOSTICS ๐Ÿฉบ

depending on how the program was configured, all diagnostics are written to the console device or reported via the syslog(3) facility. error messages are produced if the port argument does not specify a terminal device; if there is no utmp entry for the current process (System V only); and so on.


๐Ÿ‘‘ AUTHORS ๐Ÿ‘‘

Werner Fink <werner@suse.de>, Karel Zak <kzak@redhat.com>

the original agetty for serial terminals was written by W.Z. Venema <wietse@wzv.win.tue.nl> and ported to Linux by Peter Orbaek <poe@daimi.aau.dk>.


๐Ÿšจ REPORTING BUGS ๐Ÿšจ

for bug reports, use the issue tracker <https://github.com/util-linux/util-linux/issues>.


๐Ÿ’พ AVAILABILITY ๐Ÿ’พ

the agetty command is part of the util-linux package which can be downloaded from Linux Kernel Archive <https://www.kernel.org/pub/linux/utils/util-linux/>.


and that's a wrap on the whole page bestie!! ๐Ÿ’– this one's from util-linux 2.42.4, dated 2026-09-21, and it's the AGETTY(8) page โ€” go forth and slay your terminals, no cap. โœจ๐ŸŽ€๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from
  • arch rolling: util-linux 2.42.4-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND ISC AND LGPL-2.1-or-later AND LicenseRef-PublicDomain
  • ๐Ÿ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms