How to Send a Message to Logged Users in Linux Terminal
How can I send a messages to logged on users in a Linux server? If you are asking this question, then this guide will help you learn how to do that. We will demonstrate how to send a message to all or a specific logged on user, on the terminal in Linux.
Linux offers a variety of means for sending messages to users logged on to a server as explained in the two methods below.
In the first method, we will use wall command – write a message to all currently logged in users on the terminal as shown.
# wall "System will go down for 2 hours maintenance at 13:00 PM"
To disable the normal banner printed by wall, for example:
Broadcast message from [email protected] (pts/2) (Sat Dec 9 13:27:24 2017):
-n (Suppress the banner) flag, this however, can only be used by the root user.
# wall -n "System will go down for 2 hours maintenance at 13:00 PM"
In the second method, we will use write command, which comes pre-installed on all if not most Linux distributions. It allows you to send a message to another user in the terminal using tty.
First check the all logged on users with the who command as shown.
There are currently two users are active on the system (tecmint and root), now the user aaronkilik is sending a message to the root user.
$ write root pts/2 #press Ctrl+D after typing the message.
- Show a Custom Message to Users Before Linux Server Shutdown
- Protect SSH Logins with SSH & MOTD Banner Messages
That’s all! Do share with us other methods or commands for sending messages to all logged on users through the terminal in Linux. If you have any queries, please use the feedback form below.