Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

…pseudo terminal file name associated to a terminal emulator window? I accidentally found it, just typed something like


but forgot that variable, I googled it, looked in man pages, in ~/bash_history, but there are only commands of the first opened terminal and they're very old (~half a day) though.

share|improve this question
up vote 1 down vote accepted

you can use the tty command:

$ tty
share|improve this answer

To get the current tty you can use the tty command

[sr@panther ~]$ echo "Your current TTY is $(tty)"
Your current TTY is /dev/pts/5

Or you can set it to a variable manually if you want

echo $MYTTY
share|improve this answer

If you want to find an environment variable with some special value you can do:

env | grep "the value you look for"
share|improve this answer
I’ve tried grepping env. Nothing there contained such a value. – tijagi Feb 5 '13 at 19:47

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.