Is possible to send a message (popup window or something) to local user logged into X (xdm, fluxbox) from console ? For example: user1 is logged and using X/fluxbox, user2 logging into the same box by ssh to console. Now - what user2 have to do to send message to user1 ?

link|improve this question

67% accept rate
feedback

1 Answer

up vote 4 down vote accepted

The xmessage tool lets you do exactly that; present a popup window to users with a text message inside.

Example: user2 logs into a BASH session on the box and issues:

export DISPLAY=':0.0'
xmessage "some message here"

if you log into a TSCH session, it'd be something like this:

setenv DISPLAY ':0.0'
xmessage "some message here'

Alternatively, you can send messages to terminal sessions in one of two ways:

Using wall (=warn all [users])

From the man page:
Wall displays the contents of file or, by default, its standard input, on the terminals of all currently logged in users.

If you want to target a specific user, use write. Again, man tells us:

The write utility allows you to communicate with other users, by copying lines from your terminal to theirs.

link|improve this answer
If a recipient (user1 in my example) is logged into X11, and haven't opened xterm or other terminal - will wall work too ? I think that user1 will not see messages. – marioosh Jul 13 '11 at 7:33
I updated my answer to include the 'xmessage' solution. That will show a small window to the user, irrespective of whether they have a terminal open. – mjk Jul 13 '11 at 7:36
1  
Incidentally, 'apropos' is a useful utility to know; it searches manual pages for the text you pass to it. Try running 'apropos message' and see what it returns. – mjk Jul 13 '11 at 7:44
I know xmessage but how to run it by user1 and get this small window opened on user2's screen ? is it even possible ? – marioosh Jul 13 '11 at 7:53
feedback

Your Answer

 
or
required, but never shown

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