tty — Return User’s Terminal Name

Synopsis

/usr/bin/tty [-l][-s] 

Description

The tty command writes to the standard output the name of the terminal that is open as standard input. The name that is used is equivalent to the string that would be returned by the ttyname(3C) function.

Options

-l Print the synchronous line number to which the user's terminal is connected if it is on an active synchronous line.
-s Inhibit printing of the terminal path name; enables you to test just the exit status. The -s option is useful only if you want the exit status. It does not rely on the ability to form a valid path name. Portable applications should use test -t.

Examples

The following example shows the output of the tty command from two separate terminal ...

Get Solaris™ 7 Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.