1

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

$ echo $SOMETHING
/dev/pts/4

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.

3 Answers 3

2

you can use the tty command:

$ tty
/dev/pts/3
2

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

MYTTY=`tty`
echo $MYTTY
1

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

env | grep "the value you look for"
1
  • I’ve tried grepping env. Nothing there contained such a value.
    – tijagi
    Feb 5, 2013 at 19:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .