Operating systems, development tools, and professional services
for connected embedded systems
for connected embedded systems
![]() |
![]() |
![]() |
![]() |
tty
Return the user's terminal name (POSIX)
Syntax:
tty [-s]
Runs on:
Neutrino
Options:
- -s
- Be silent; don't output the terminal name. This option is useful if you're concerned only with tty's exit status.
Description:
The tty utility writes to the standard output the name of the terminal that's open as standard input. If standard input isn't a terminal (e.g. it's a file such as /dev/null), the string not a tty is output instead.
![]() |
The -s option is deprecated by POSIX; you can achieve the effect of this option, simply and portably, by redirecting output to /dev/null or by using the shell builtin, test -c. |
Examples:
The following command prints /dev/con1 if run on console 1:
tty
The following command prints not a tty because /dev/null causes isatty() to return 0:
tty </dev/null
Exit status:
- 0
- Success.
- > 0
- An error occurred.
![]() |
![]() |
![]() |
![]() |

![[Previous]](../prev.gif)
![[Contents]](../contents.gif)
![[Index]](../keyword_index.gif)
![[Next]](../next.gif)
