Thanks to the wall command in Linux, you can flawlessly send desired messages to the users who are logged in or currently working on the server. Here is how it needs to be done.
There is no denying that you, as an admin, bear a number of instructions for the users who are logged in to your Unix system. Sometimes, taking hello of email or other communication methodologies is alright; however, the same is not always the case.
Suppose you need your system to restart or shut down in the next few minutes. In that case, sending emails to the users stating that they should have their work progress saved is not efficient as you don’t have control over their read time. This is when the wall command clicks in.
It is genuinely a handy utility that can serve as a day saver for any multiuser system admin. Here, in this article, we’ll talk about the usage of the wall command in Linux.
Using Wall Command in Linux
The wall command in Linux is used to send messages or even the content of any desired file to the users who are currently logged in to the Unix system. Specifying a message or a file alongside the
$ wall command will make the admin of a system make the users aware of any situation through a message.
Talking about the syntax of the wall command in Linux, it looks something like this:
$ wall [options] [message-or-filename]
However, in case you fail to specify a message or a file, the command will simply read the message from the respective standard input. Also, it is vital to keep in mind that the method only works to display messages to those users who have their Terminal window open,
Send Message to All Users Using Wall Command in Linux
The wall command makes sending messages to all the logged-in users to the Unix system pretty seamless. You need to input the wall command and then type in the message you wish to forward.
Run the following command:
$ wall The system is going down for 1-hour maintenance.
Corresponding to that, here is the output displayed to the users who are logged in to the system via
SSH. The message will also highlight the fact that the same is a broadcast from the system admin.
The system is going to restart in a few minutes. Please save your work!
Wall Command in Linux Reading Messages from stdin
As already mentioned, whenever you’ll not specify a message or a file alongside the wall command, it will simply ready messages from standard input. With that being said, all you need to do is,
Input the following command:
Hit the “Enter” key.
Once you’re done, type in the desired messages.
Finally, press the “Ctrl+D” key combination for sending those messages.
Send Message from a File Using Wall Command in Linux
There are many instances when a particular message needs to be sent in a repetitive manner. Although you’ve got the option to type those messages each time, placing them inside a file and using the wall command is a more efficient approach instead.
The process sits almost similar to what we did previously; however, you’ll need sudo privileges for sending messages saved in a file to the logged-in users.
Create a .txt file with the desired message inside. Suppose it to be, the system will go down for 1-hour maintenance.
Now launch the Terminal using the “Ctrl+T” key combination and run the following command:
$ sudo wall [filename]
On passing the filename to the wall command, the system will send the message contained inside to the currently logged-in users. The output received from the .txt file will look like this:
Using Wall Command in Linux to Send Messages to a Group
Do you wish to send messages to a particular group of users who are currently logged in instead of sending them to each one? Well then, wall command will help you do that as well. The method doesn’t require you to have sudo privileges.
Simply launch the Terminal and use the following syntax:
$ wall -g [group] [message]
If the desired group is
sshusers and the message reads, The system will go down for 1-hour maintenance; run the wall command in the following way:
$ wall -g sshusers The system will go down for an 1-hour maintenance.
As you can clearly see from the above images depicting the outputs, the wall command in Linux generally displays a banner right before the message. The banner shares the name of the sender alongside stating that the message is a broadcast.
Suppressing the banner is very simple. Just use the
-n option together with the wall command. In other words, run the command in the following manner:
$ wall -n <message>
Run the following command
$ wall -n The system will go down for an 1-hour maintenance
Now all the users who’re currently logged in to the Unix system and have their Terminal window open shall receive the message without the usual banner.
Checking the Wall Version Info
1. Launch the Terminal
2. Run the following command:
$ wall -V
The output will display the wall version your system is using.
There you’ve it. We’ve minutely walked you through the usage of the wall command in Linux. In this article, you’ll learn how to use the wall command and send messages to the logged-in users in the most promising manner. For any queries, leave a comment below.
If this guide helped you, please share it.