Posted: . At: 10:07 AM. This was 8 years ago. Post ID: 9653
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.


Send a message to logged in Linux users and other nice tricks.


To send a message to logged in Linux users with the wall command, just open it and type a message. Then press ^D to send it.

jason$ wall
Hi
 
Broadcast message from jason@jason-desktop (pts/0) (Sat Aug 27 22:24:05 2016): 
 
Hi

This is useful for messaging users about an upcoming server restart or maintenance.

If the user was not using a terminal window or a VT, they would not see the message, so use this instead. Xmessage will pop up a message on the user`s desktop. That way they will get the message.

22:28:23 0 ~
jason$ export DISPLAY=':0.0'
 
22:29:00 0 ~
jason$ xmessage "Server restart in 10 min."

This is what it looks like.

Xmessage displaying a message from a server admin.
Xmessage displaying a message from a server admin.

Another way is using the write command. This requires the user to give it the username and the TTY the user is logged into. This is only useful if you actually know that a user is on a terminal or TTY and which one.

09:57:59 1 ~
jason$ write jason /dev/pts/0
 
Message from jason@jason-desktop on pts/0 at 09:58 ...
Hello
Hello
EOF

If I try to message a terminal with noone on it I get this error..

09:58:14 0 ~
jason$ write jason /dev/tty2
write: jason is not logged in on tty2

But this is still useful. The wall or warn all command is the best for messaging users that are in terminals, and the xmessage command for messaging users in a desktop environment. Good ways to warn users of upgrades or server maintenance.


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.