To print the file name of the terminal connected to standard input (keyboard) you need to use command called tty.
This command is available on Solaris, Linux, FreeBSD, and other Unixish operating systems.
The tty utility writes the name of the terminal attached to standard input to standard output.
You can also use who or w command to find out terminal/tty. Type tty command as follows:
Code:
$ tty
Output:
/dev/pts/2
Use following command:
Code:
$ tty
Output:
/dev/tty3 You can also use w or who commands to find out tty:
Code:
$ w
Output:
NAME LINE TIME COMMENT vivek tty1 Feb 6 00:26 root tty2 Feb 5 14:57 OR use who command:
Code:
$ who
vivek tty1 Feb 6 00:26 root tty2 Feb 5 14:57