This tutorial explains Linux “tty” command, options and its usage with examples.
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.
-s, –silent, –quiet
print nothing, only return an exit status
display this help and exit
output version information and exit
$ tty /dev/tty3
You can also use w or who commands to find out tty:
$ w NAME LINE TIME COMMENT abcde tty1 Feb 6 00:26 root tty2 Feb 5 14:57
OR use who command:
$ who abcde tty1 Feb 6 00:26 root tty2 Feb 5 14:57
Sanfoundry Global Education & Learning Series – 1000 Linux Tutorials.
- Apply for Programming Internship
- Buy Linux Books
- Apply for Linux Internship
- Practice Programming MCQs
- Buy Information Technology Books