This tutorial explains Linux “tty” command, options and its usage with examples.
DESCRIPTION
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.
SYNOPSIS
tty [OPTION]…
OPTIONS :
-s, –silent, –quiet
print nothing, only return an exit status
–help
display this help and exit
–version
output version information and exit
EXAMPLE
$ 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.
- Practice Programming MCQs
- Apply for Programming Internship
- Check Linux Books
- Check Information Technology Books