Sometimes I have to bring down the server and would like to warn users. I can send email, but they might not read that until after I have already interrupted their work.
The "wall" command does that.
Login as root, type "wall" <ENTER, then whatever you want to say (multiple lines are OK), followed by <ENTER and then CTRL-D
Note that users may not see the message - if their screen updates before they notice this, they won't see it.
The length of the message will probably be limited to something less than 25 lines. You may be able to specify that you only want to write to a certain group; check the man/info page.
As root, you can just blast whatever you want to users terminal devices - not very friendly. At most places, somebody picks up the phone and does a loudspeaker announcement or sends email instead.
I suggest Unix for the Impatient as a good book for this sort of thing.
If it's an individual user, you can use "write" to tell them that you are shutting down their database or that they are locking a file you need to access and so on.
Users can use "write" to send messages to each other, too, although they can choose to block such messages by using "mesg no". People do that to avoid chatty folks messing up their screens. That won't stop a root user, though (and it's assumed you have good reason for the interruption)..
Here's what it looks like if I write myself with "write tony ttys001" (if I didn't have multiple teminal sessions going, I could just say "write tony", but that just picks the least idle tty, which might not be what I want):
Message from tony@Anthonys-iMac.local on ttys003 at 09:45 ... hello
New users think this is a chat session and they can just type back. It CAN work like chat, but I'd need to write back first:
$ write tony ttys003
After that, the users can chat back and forth. The man page on my Mac notes:
Yeah.. I don't think many people are using this today :-)
Still, you might find it useful in some situations where you are working with someone remote at the command line and for some reason have no more convenient way to communicate. I wouldn't expect them to lnow about "-o", though!
Got something to add? Send me email.
More Articles by Tony Lawrence © 2013-07-30 Tony Lawrence
A learning experience is one of those things that say, "You know that thing you just did? Don't do that." (Douglas Adams)