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 put a simple echo command in a CLI tty by user1 expecting it to reach user2 who is logged in a separate tty.

echo "Hello, world!" >> /dev/tty5

I expected user2 to get the echo message but nothing shows up.

Does each user get his/her own "set" of tty[1-7]?

Edit: I suspect this may be a permissions issue. I was actually exploring cron jobs and had set a cron job to echo a "hello world" message every minute from user1 logged into tty2 directed to tty5 where user2 is logged in but user2 never got the echoed messages.

share|improve this question
1  
4  
Have a look at the write command. That's more along the line of what you want. –  Max Dec 30 '12 at 19:24
    
What shell are you using? Did you get any error message? What is the output of echo "Hello, world!" >> /dev/tty5; echo $?? –  Gilles Dec 30 '12 at 23:44
    
@Gilles It's Bash for both users. System is a Centos 6.3 installation. –  haziz Dec 31 '12 at 1:12
add comment

1 Answer 1

If user2 is logged into tty5, he is the owner of /dev/tty5. If he has messaging enabled, then you can send him a message using write user2, but if he doesn't, you're out of luck unless you are root. echo "Hello, world!" >> /dev/tty5 only works if executed by root or by user2.

share|improve this answer
    
mesg y will enable receiving messages and mesg n will disable it.. –  Gert van den Berg Dec 31 '12 at 8:17
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.