wall (an abbreviation of write to all) is a Unix command-line utility that displays the contents of a computer file or standard input to all logged-in users. It is typically used by root to send out shutting down message to all users just before poweroff.
You can use wall command to Broadcasting a Message with the syntax below:
wall [OPTIONS] [File] OR wall [OPTIONS] [Message]
NOTE: If no file is specified wall reads the message from the standard input.
- You can do that with invoke the wall command with the message as the argument as shown below:
wall "Attention please, The system will be restarted in 1 hour."
The message will be broadcasted to the users currently logged in.
- To show only the text you types and disappear the banner, invoke the command with the -n or (–nobanner) option
wall --nobanner "Attention please, The system will be restarted in 1 hour."
- If you want to write multi-line messages, invoke the wall command, it will wait for you to finish your lines then you should press Ctr+D to end it then it will broadcast the message
- Here is an example showing how to use the echo command with wall on pipe to broadcast a message
echo "Attention please, The system will be restarted in 1 hour." | wall
- Also you can broadcast a Message From a File
It will display all the content of the file in addition to the broadcast banner message of wall command
- Finally you can Broadcast a Message to a Group
So to send a message only to members of a given group, run the command with the -g or –group option, followed by the group name.
wall -g Devlopers "The system will be restarted in 1 hour."
We illustrated how to use wall command to display a file content or standard input to all logged-in users on the system.