AGETTY(8)

โœจ AGETTY(8) โ€” the alternative Linux getty โœจ

System Administration ๐ŸŽ€ bestie we are SO in the system admin section rn


๐Ÿ’– NAME ๐Ÿ’–

agetty โ€” it's the alternative Linux getty, no cap ๐Ÿซถ


๐ŸŒธ SYNOPSIS ๐ŸŒธ

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

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

okay so, storytime: agetty opens a tty port, hits you with a login-name prompt, and then runs the /bin/login command. That's the whole job. It's normally launched by init(8), so likeโ€ฆ you're not usually the one calling it, it just happens to you ๐Ÿ’…

Now here's the tea: agetty has a bunch of non-standard features that are genuinely iconic for hardwired lines and dial-in lines:

  • It adapts the tty settings to parity bits and to erase, kill, end-of-line and uppercase characters while it's reading a login name. The program can handle 7-bit characters with even, odd, none or space parity, and 8-bit characters with no parity. These special characters are the ones it recognizes: Control-U (kill); DEL and backspace (erase); carriage return and line feed (end of line). Also go peek at the --erase-chars and --kill-chars options, they're relevant ๐Ÿ‘€
  • It can optionally figure out the baud rate from the CONNECT messages that Hayes(tm)-compatible modems spit out. detective behavior fr ๐Ÿ”
  • It can optionally not hang up when it's handed an already opened line โ€” which is super useful for call-back applications.
  • It can optionally not display the contents of the /etc/issue file. shy era.
  • It can optionally display alternative issue files or directories instead of /etc/issue or /etc/issue.d. main character chooses her own entrance, periodt.
  • It can optionally not ask for a login name at all.
  • It can optionally invoke a non-standard login program instead of /bin/login. rebranding โœจ
  • It can optionally turn on hardware flow control.
  • It can optionally force the line to be local, with no need for carrier detect. independent queen ๐ŸŒˆ
๐Ÿšจ and listen: this program does not use the /etc/gettydefs (System V) or /etc/gettytab (SunOS 4) files. so don't go looking for them, they are not invited to this party ๐Ÿ’€

๐Ÿ‘‘ ARGUMENTS ๐Ÿ‘‘

๐Ÿ’œ port

A path name relative to the /dev directory. So like, relative. Remember that.

But plot twist โ€” 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. lazy girlboss move, love that for it ๐Ÿซถ

Under System V, a "-" port argument should be preceded by a "--".

โš ๏ธ yes really, that's not a typo, that's the rule.

๐Ÿ’œ baud_rate,...

A comma-separated list of one or more baud rates. Every single time agetty receives a BREAK character it advances through the list, and the list is treated as if it were circular. carousel energy ๐ŸŽ 

Baud rates should be specified in descending order, so that the null character (Ctrl-@) can also be used for baud-rate switching. order matters bestie, don't freestyle this one ๐Ÿ™ˆ

This argument is optional and unnecessary for virtual terminals. vts don't need it, they're built different ๐Ÿ’…

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

๐Ÿ’œ term

The value to be used for the TERM environment variable. This overrides whatever init(1) may have set, and it's inherited by login and the shell. so it ripples down the whole chain, iconic behavior ๐ŸŒŠ

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


okay that's the setup, keep scrolling bestie, there's more ๐Ÿ‘‡

โœจ OPTIONS โœจ

okay bestie, this is the part where agetty shows you every single little switch it has. it's a lot. we're gonna get through it together. ๐Ÿซถ

  • -8, --8bits โ€” tells agetty to assume your tty is 8-bit clean, which means parity detection is off. no parity sleuthing for you.
  • -a, --autologin username โ€” logs in the specified user automatically, no username or password questions, no waiting. using this option causes an -f username option and argument to get added to the /bin/login command line. head over to --login-options if you wanna mess with how this one behaves.
ngl this one has a lil side effect: because on auto-login agetty doesn't read from the line at all, it never gets the chance to optimize the line setting, so --autologin may affect the way getty initializes the serial line. ๐Ÿ’…
  • -c, --noreset โ€” don't reset terminal cflags (the control modes). see termios(3) for the whole lore.
  • -E, --remote โ€” so usually, when something like telnetd(8) calls login(1), it hands over a remote hostname. this option is what lets agetty pass what it's using as a hostname along to login(1) so it can land in utmp(5). see --host, login(1), and utmp(5).
    • if you gave --host fakehost, then an -h fakehost option and argument get added to the /bin/login command line.
    • if you gave --nohostname, then an -H option gets added to the /bin/login command line.

see --login-options.

  • -f, --issue-file path โ€” gives a ":" delimited list of files and directories to display instead of /etc/issue (or whatever else would've gone there). all the files and dirs you name get displayed, and missing or empty files are silently ignored (no drama). if the path you gave is a directory, then it displays all files with the .issue file extension from that directory in version-sort order. this is how you get custom messages popping up on different terminals. heads up: --noissue overrides this whole thing. ๐ŸŽ€
  • --show-issue โ€” displays the current issue file (or other) right there on the current terminal, then exits. use it to review the current setting โ€” that's it, it's literally not designed for any other purpose. also note the output may use some default or incomplete information, because proper output depends on the terminal and on the agetty command line.
  • -h, --flow-control โ€” turns on hardware (RTS/CTS) flow control. and listen, it's on the application to disable the software (XON/XOFF) flow protocol where appropriate. that part's not agetty's business. โœจ
  • -H, --host fakehost โ€” writes that specified fakehost into the utmp file. normally there's no login host given at all, because agetty is out here serving local hardwired connections and consoles. but this option? lowkey useful for identifying terminal concentrators and the like. ๐Ÿ‘‘
  • -i, --noissue โ€” don't display the contents of /etc/issue (or other) before writing the login prompt. why would you want that? because terminals or communications hardware can get confused receiving a ton of text at the wrong baud rate, and dial-up scripts may straight up fail if the login prompt is preceded by too much text. keep it minimal bestie.
  • -I, --init-string initstring โ€” sets an initial string to send to the tty or modem before sending anything else. classic use: initializing a modem. non-printable characters? send them by writing their octal code with a backslash (\) in front. for example, to send a linefeed character (ASCII 10, octal 012), you write \12. iconic. ๐ŸŒˆ
  • -J, --noclear โ€” don't clear the screen before prompting for the login name. (by default, the screen is cleared, just so we're clear.)
  • -l, --login-program login_program โ€” invoke the login_program you specify instead of /bin/login. this opens the door to a non-standard login program, which could for example ask for a dial-up password or use a whole different password file. see --login-options.
  • -L, --local-line[=mode] โ€” controls the CLOCAL line flag. the optional mode argument is auto, always or never. if you leave mode out, the default is always. if you don't give --local-line at all, the default is auto.
    • always โ€” forces the line to be a local line with no need for carrier detect. handy when you've got a locally attached terminal where the serial line doesn't set the carrier-detect signal.
    • never โ€” explicitly clears the CLOCAL flag from the line setting, and now the carrier-detect signal is expected on the line.
    • auto โ€” the agetty default. it does not modify the CLOCAL setting and just follows whatever the kernel has enabled.
  • -m, --extract-baud โ€” tries to extract the baud rate out of the CONNECT status message that Hayes(tm)-compatible modems produce. those status messages come in the form: "<junk><speed><junk>". agetty assumes the modem emits its status message at the same speed as specified with (the first) baud_rate value on the command line.
โš ๏ธ real talk: since --extract-baud may fail on heavily-loaded systems, you still should enable BREAK processing by enumerating all the expected baud rates on the command line. don't skip that step.
  • --list-speeds โ€” displays the supported baud rates. these get determined at compilation time, so what you see is what got baked in. ๐Ÿ“
  • -n, --skip-login โ€” don't prompt the user for a login name. people pair this with the --login-program option to invoke a non-standard login process like a BBS system. but here's the tea: with --skip-login, agetty gets no input from the user who logs in, so it won't be able to figure out parity, character size, or newline processing for the connection. it defaults to space parity, 7 bit characters, and ASCII CR (13) end-of-line character.
๐Ÿ’€ beware: the program that agetty starts (usually /bin/login) is run as root. respect the power.
  • -N, --nonewline โ€” don't print a newline before writing out /etc/issue.
  • -o, --login-options login_options โ€” options and arguments that get passed to login(1). wherever you put \u, it gets replaced by the login name. like, for example:
--login-options '-h darkstar -- \u'

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

๐Ÿšจ please read the SECURITY NOTICE below before using this option. i'm serious, it's right there for a reason.
  • -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. lazy girl summer, but for processes. ๐Ÿ˜Œ
  • -r, --chroot directory โ€” change root to the specified directory.
  • -R, --hangup โ€” calls vhangup(2) to do a virtual hangup of the specified terminal. bye bestie ๐Ÿ‘‹
  • -s, --keep-baud โ€” tries to keep the existing baud rate. the baud rates from the command line get used when agetty receives a BREAK character. and if another baud rate was specified, the original baud rate is also saved to the end of the wanted baud rates list. this is how you return to the original baud rate after unexpected BREAKs. so thoughtful. ๐ŸŽ€
  • -t, --timeout timeout โ€” terminates if no user name could be read within timeout seconds. ngl, using this option with hardwired terminal lines is not recommended.
  • -U, --detect-case โ€” turns on support for detecting an uppercase-only terminal. it detects a login name containing only capitals as indicating an uppercase-only terminal, and then turns on some upper-to-lower case conversions. note that this has no support for any Unicode characters. ๐Ÿ’…
  • -w, --wait-cr โ€” waits 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. super useful alongside the --init-string option.
  • --nohints โ€” don't print hints about Num, Caps and Scroll Locks. (love that for you.)
  • --nohostname โ€” by default the hostname gets printed. with this option enabled, no hostname at all will be shown. you can also pull this off with the LOGIN_PLAIN_PROMPT option in the /etc/login.defs configuration file (more details below).
  • --long-hostname โ€” by default the hostname is only printed up until the first dot. with this option enabled, the fully qualified hostname (found by gethostname(3P) or, if that doesn't find it, by getaddrinfo(3)) is shown. come through, full government name. ๐Ÿ‘‘
  • --erase-chars string โ€” 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' used to be '#', but since util-linux 2.23 no additional erase characters are enabled by default.
  • --kill-chars string โ€” 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' used to be '@', 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 opening tty.
  • --nice number โ€” run login with this priority.
  • --reload โ€” asks all running agetty instances to reload and update their displayed prompts, but only if the user hasn't commenced logging in yet. after doing so, the command exits. fyi, 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)). quick heads up: that config file could actually be distributed with another package (usually shadow-utils). here's what matters to agetty:

LOGIN_PLAIN_PROMPT (boolean) โ€” tells agetty that printing the hostname should be suppressed in the login: prompt. it's 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, this one's important ๐Ÿ”ฅ If you're out here using --login-program and --login-options, you need to know that a malicious user could try to sneak lognames with embedded options into the mix, and those options then get passed straight to whatever login program you're using. Not cute. agetty does check for a leading - and makes sure the logname gets passed as one single parameter (so embedded spaces won't magically create yet another parameter), but depending on how the login binary parses its command line, that might not be enough. So please, fr fr, check that your login program can't be abused this way. ๐Ÿ™ˆ

Some programs use -- to say "hey, everything after this is not an option, stop interpreting." 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 the content of the directory gets printed after the /etc/issue content. But if /etc/issue doesn't exist, then the directory is ignored, periodt. All the files with the .issue extension from that directory get printed in version-sort order. The whole point is that you can 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 whether /etc/issue exists or not. This change allows for the generation of issue files by default. slay ๐ŸŽ€

The default paths may be completely overridden by the --issue-file option. In that case the specified path has to be a file or directory, and all the default issue file and directory locations are ignored. ๐Ÿ‘‘

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

And yesss, you can review the current issue file by running 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. Let's go through every single one, no skipping โœจ

  • 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 the list of "good" IP addresses for all interfaces. It prints the 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 the local interface name, but they have to be done with the interface name on the machine where they will be used. ๐Ÿ‘€
  • A โ€” Insert the 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. 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

๐Ÿ“ 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 ๐Ÿ’€

okay so here's the tea, some of this is a little cursed:

  • 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. no cap ๐Ÿ’…


๐Ÿ‘‘ 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>. absolute icons, we stan ๐Ÿซถ


๐Ÿ› REPORTING BUGS ๐Ÿ›

For bug reports, use the issue tracker <https://github.com/util-linux/util-linux/issues>. (So if something's giving broken, go tell them there, bestie โœจ)


๐Ÿ“ฆ 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/>. go get it ๐Ÿ’–


and that's the whole vibe check, bestie โ€” this page is rocking util-linux 2.42.2 energy, dated 2026-06-16, and it's the AGETTY(8) manual page, so you know it's official. periodt ๐Ÿ’…โœจ๐ŸŽ€

๐Ÿ“ฆ where this page comes from