I'm writing a little curses program and I want to redirect stderr to another terminal. However, the only way of determining the correct /dev/pts/X device to redirect to that I know of is to echo text to them one at a time until it shows up where I want.

Is there a command which will give me what I'm looking for?

1 Answer 1


You are looking for the tty command, which prints the file name of the terminal connected to standard input.

You must log in to answer this question.

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