1TTY(1P)                    POSIX Programmer's Manual                   TTY(1P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       tty - return user's terminal name
13

SYNOPSIS

15       tty
16

DESCRIPTION

18       The tty utility shall write to the standard output the name of the ter‐
19       minal  that  is  open as standard input. The name that is used shall be
20       equivalent to the string that would be returned by the ttyname()  func‐
21       tion defined in the System Interfaces volume of IEEE Std 1003.1-2001.
22

OPTIONS

24       The  tty  utility  shall  conform  to  the  Base  Definitions volume of
25       IEEE Std 1003.1-2001, Section 12.2, Utility Syntax Guidelines.
26

OPERANDS

28       None.
29

STDIN

31       While no input is read from standard input,  standard  input  shall  be
32       examined  to  determine whether or not it is a terminal, and, if so, to
33       determine the name of the terminal.
34

INPUT FILES

36       None.
37

ENVIRONMENT VARIABLES

39       The following environment variables shall affect the execution of tty:
40
41       LANG   Provide a default value for the  internationalization  variables
42              that  are  unset  or  null.  (See the Base Definitions volume of
43              IEEE Std 1003.1-2001, Section  8.2,  Internationalization  Vari‐
44              ables  for the precedence of internationalization variables used
45              to determine the values of locale categories.)
46
47       LC_ALL If set to a non-empty string value, override the values  of  all
48              the other internationalization variables.
49
50       LC_CTYPE
51              Determine  the  locale  for  the  interpretation of sequences of
52              bytes of text data as characters (for  example,  single-byte  as
53              opposed to multi-byte characters in arguments).
54
55       LC_MESSAGES
56              Determine  the  locale  that should be used to affect the format
57              and contents of diagnostic messages written  to  standard  error
58              and informative messages written to standard output.
59
60       NLSPATH
61              Determine the location of message catalogs for the processing of
62              LC_MESSAGES .
63
64

ASYNCHRONOUS EVENTS

66       Default.
67

STDOUT

69       If standard input is a terminal device, a pathname of the  terminal  as
70       specified  by  the  ttyname() function defined in the System Interfaces
71       volume of IEEE Std 1003.1-2001 shall be written in the  following  for‐
72       mat:
73
74
75              "%s\n", <terminal name>
76
77       Otherwise, a message shall be written indicating that standard input is
78       not connected to a terminal. In the POSIX locale, the tty utility shall
79       use the format:
80
81
82              "not a tty\n"
83

STDERR

85       The standard error shall be used only for diagnostic messages.
86

OUTPUT FILES

88       None.
89

EXTENDED DESCRIPTION

91       None.
92

EXIT STATUS

94       The following exit values shall be returned:
95
96        0     Standard input is a terminal.
97
98        1     Standard input is not a terminal.
99
100       >1     An error occurred.
101
102

CONSEQUENCES OF ERRORS

104       Default.
105
106       The following sections are informative.
107

APPLICATION USAGE

109       This  utility  checks  the  status  of  the file open as standard input
110       against that of an implementation-defined set of files. It is  possible
111       that  no  match  can  be found, or that the match found need not be the
112       same file as that which was opened for standard  input  (although  they
113       are the same device).
114

EXAMPLES

116       None.
117

RATIONALE

119       None.
120

FUTURE DIRECTIONS

122       None.
123

SEE ALSO

125       The  System  Interfaces  volume of IEEE Std 1003.1-2001, isatty(), tty‐
126       name()
127
129       Portions of this text are reprinted and reproduced in  electronic  form
130       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
131       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
132       Specifications  Issue  6,  Copyright  (C) 2001-2003 by the Institute of
133       Electrical and Electronics Engineers, Inc and The Open  Group.  In  the
134       event of any discrepancy between this version and the original IEEE and
135       The Open Group Standard, the original IEEE and The Open Group  Standard
136       is  the  referee document. The original Standard can be obtained online
137       at http://www.opengroup.org/unix/online.html .
138
139
140
141IEEE/The Open Group                  2003                              TTY(1P)
Impressum