agetty command in Linux with Examples
agetty is a Linux version of getty. getty short for "get tty" is a Unix program running on a host computer that manages physical or virtual terminals to allow multi-user access. Linux provides a virtual terminal(tty) which is similar to the regular Linux terminal. agetty command opens a virtual terminal(tty port), prompts for a login name, and invokes the /bin/login command.
Syntax
agetty [options] port [baud_rate...] [term]
where,
- port: It is a pathname relative to the /dev directory. If a "-" is specified, then this command considers that its standard input is already connected to a tty port and that a connection to a remote user has already been established.
- baud_rate, ...: It is a comma-separated list of one or more baud rates. It should be specified in the descending order.
- term: It is the value to be used for the TERM environment variable.
Common Options used with the agetty command
Option | Description |
---|---|
-8 , --8bits | Assume 8-bit tty, meaning full 8-bit data transmission. |
-a , --autologin | Automatically logs in the specified user without a password prompt. |
-c , --noreset | Do not reset control mode upon start. |
-E , --remote | Allows passing a hostname to login for remote connections (e.g., via telnetd ). |
-h , --flow-control | Enables hardware flow control using CTS/RTS handshaking for smoother communication. |
-i , --noissue | Do not display the issue file (custom login message). |
-J , --noclear | Do not clear the screen before displaying the login prompt. |
-m , --extract-baud | Extract the baud rate from the terminal device during connection. |
-n , --skip-login | Skip the login prompt and go directly to session (useful for auto-login setups). |
-p , --login-pause | Wait for the user to press any key before showing the login prompt. |
-R , --hangup | Perform a virtual hangup (vhangup) to disconnect the specified terminal. |
-s , --keep-baud | Attempt to keep the previously used baud rate for the terminal connection. |
-t , --timeout | Sets a timeout (in seconds) to terminate the session if the login prompt is not completed in time. |
-U , --detect-case | Detect uppercase-only terminals and adjust login accordingly. |
--help | Display a help message with a list of all available options. |
--version | Display the current version of the agetty command. |
For more details about the options you can run the following command on the terminal:
agetty --help

Linux agetty command Examples
1. agetty -8 - linux
- -8 option for 8-bit tty.
- '-' for specifies that standard input is already connected to a tty port.
- baud rate is optional so not used here.
- 'linux' is value of TERM environment variable.

2. agetty -8 -t 5 - linux
- -t 5 is the login process timeout.

3. agetty -h -t 60 tty 9600 vtxxx
- tty refers to the device /dev/tty.
- 9600 is the bits per second bound rate.
- vtxxx is the TERM environment variable to indicate that a VTxxx terminal is connecting, in the previous example 'linux' is used as TERM env.
- -h activates CTS/RTS handshaking (flow control).
- -t 60 allows 60 seconds for someone to attempt to log in before the modem is hung up.

4. agetty -a -h -t 60 tty 9600 vt102
- -a specifies autologin.

5. agetty --version
To display the version information.

6. agetty -a -h -t 60 -U -s -m tty 9600 vt100
- -U detects the uppercase terminal.
- -s try to use existing baud rate.
- -m use exact baud rate specified in the command.

Conclusion
The agetty command is an essential tool for managing terminal sessions in Linux, particularly for embedded systems, servers, and environments requiring serial connections. With its numerous options, such as autologin, flow control, timeout settings, and baud rate management, agetty provides robust control over terminal and user session management.