Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

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

share|improve this answer
add comment

Your Answer

 
discard

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.