System
consoletype
Print the type of console connected to standard input.
consoleterminalsystemtty
Additional Notes
consoletype reports what kind of console is attached, such as a virtual console, serial console, or pseudo-terminal depending on system support.
It is mostly useful in scripts that behave differently on local consoles versus remote or pseudo-terminal sessions.
Syntax
consoletype
Parameters
- No arguments are normally needed.
- Standard input: The terminal or console being inspected.
Examples
consoletype
Print the current console type.
tty
Show the terminal device path.
[ "$(consoletype 2>/dev/null)" = "pty" ] && echo remote-or-pseudo
Use it in a conditional script.
Practical Notes
- This command is not available on every distribution.
- Use
tty,who, or environment variables such asSSH_TTYfor related checks. - Scripts should handle missing
consoletypegracefully.