tty Command in Linux

This tutorial explains Linux “tty” command, options and its usage with examples.

tty – print the file name of the terminal connected to standard input

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]…

advertisement
advertisement

OPTIONS :

-s, –silent, –quiet
print nothing, only return an exit status
–help
display this help and exit
–version
output version information and exit

EXAMPLE

Note: Join free Sanfoundry classes at Telegram or Youtube
$ 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:

advertisement
$ who
 
abcde    tty1         Feb  6 00:26
root     tty2         Feb  5 14:57

Sanfoundry Global Education & Learning Series – 1000 Linux Tutorials.

advertisement
If you wish to look at all Linux commands and their usage examples, go to Linux Commands Tutorial.

If you find any mistake above, kindly email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.