How To Use agetty Command In Linux (Examples)

agetty command in Linux platform is used for managing physical or virtual terminals to allow multiple user access. This command is referred as a similar command as getty in Unix and stands for “get tty”. In the Linux operating system, the user can access the virtual terminal called tty that seems to be similar as normal terminal. Running agetty command opens the virtual terminal using tty port and prompts users for login name and invokes /bin/login/command.

Syntax to use agetty command in Linux

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

Description of parameters used in above syntax includes port, baud rate and term is here mentioned:

  • port: it’s basically a pathname that is relative to /dev directory. If this argument is left as “-”, the command determines that its standard input is already connected to tty port, which indicates that connection to a remote user is already established.
  • baud_rate…: it can be set as one or more baud rates separated by a comma, and should be given in descending order.
  • term: it’s specified for TERM environment variable.

Available options to use with agetty command in Linux

  • -8 | -8bits: assumes tty with 8 bits value
  • -a | -autologin: specified user logins automatically
  • -c | -noreset: runs the agetty command in no reset control mode
  • -E | -remote: allows agetty to pass what it is using for a hostname to login for use in utmp.
  • -h | -flow-control: used for enabling CTS/RTS slow of control
  • -i | -noissue: used for displaying no issue file
  • -j | -noclear: tells agetty to not clear the screen before prompt
  • -m | -extract-baud: allows agetty to use extract baud rate during connection
  • -n | -skip-login: tells agetty to prompt not for login
  • -p | -login-pause: the agetty waits here for users to press any key before the login prompt
  • -R | -hangup: runs vhangup() function to hangup virtual specified terminals
  • -s | -keep-baud: tells agetty to try using previously used baud rate
  • -t | -timeout: terminates the login session if no username can be read within specified timeout seconds
  • -U | -detect-case: turns on the support for detecting uppercase-only terminal
  • -h | -help: shows help information

Examples of agetty command in Linux

1: for console tty:

agetty 9600 ttyS1

2: For displaying agetty version information

agetty --version