Beginners Guide for Wall Command in Linux

Linux TLDR
Last Updated:
Reading time: 3 minutes

If you are a sysadmin, then wall command can be your next favorite Linux tool, thinking why? With the help of this tool, you can broadcast messages to all logged-in users on your system, either locally or via SSH.

This tool comes in handy, especially when you intend to start maintenance work (or something else) on your server and want to notify other users in advance.

Stick with this article until the end to learn more about the wall command and its different options (with practical examples).

Tutorial Details

DescriptionBroadcast Messages to All Users
Difficulty LevelLow
Root or Sudo PrivilegesNo
OS CompatibilityUbuntu, Manjaro, Fedora, etc.
Prerequisiteswall
Internet RequiredNo

Syntax of the Wall Command

The wall command takes two arguments: one is the option, and the other is the message or filename (yes, it accepts files) to be broadcast.

$ wall [OPTION] [MESSAGE or FILENAME]

Broadcast Message to All Users

The simplest way to use this command is to give the message as an argument that needs to be broadcasted to every user connected to your system.

$ wall "The server will be down for one hour for maintenance."

Output:

Broadcasting the message to all users

The terminal screen for other logged-in users will look like the one below after you issue the above command:

Terminal screen for other logged-in users when message broadcasted

The first line in the above picture is the banner, which includes the information of the sender with its TTY along with the date and time when the message was sent.

As a sysadmin, you can hide this banner from the logged-in users screens when the message is broadcast by following the next section.

Broadcast Message Without a Banner

The “-n” flag will remove the banner from the terminal screen of the logged-in users when the message is broadcast by the sysadmin.

📝
Non root users are required to specify sudo at the beginning of the command.
$ sudo wall -n "The server will be down for one hour for maintenance."

Output:

Broadcasting message to users without banner

Broadcast Text Content from a File

It might be inconvenient to broadcast a long text message from the terminal. If this is the case, you can put the message in a text file and use it as an argument to the wall command.

The following is the content of the text file:

$ cat msg
The server will be down for one hour for maintenance.

You can copy the above content for demonstration purposes and save it to a file with the name “msg“. Then pass this file with its absolute or relative path as an argument to the wall command.

$ sudo wall msg

Output:

Broadcast message to user from the text file

Broadcast Message to a Group of Users

Sometimes, you might not intend to broadcast a message for maintenance work; it can be anything else for a specific group of users.

In this case, you can use the “-g” flag with the group name as an argument to broadcast a message to a specific group of users; in the following example, it’s the “sudo” group.

$ wall -g sudo "The server will be down for one hour for maintenance."

The above command will send the specified message to all users in the sudo group.

Broadcast message to specific group of users

Broadcast Message Under Specific Time

If the message you intend to send to other logged-in users becomes irrelevant after some time, you can use the “-t” flag using seconds as an argument under which it tries to broadcast the message.

$ wall -t 10 "The server will be down for one hour for maintenance."

Output:

Broadcast message before the timeout

Conclusion

As you learned from the different examples of wall commands in this article, this is a great way for you as an administrator to let other logged-in users know about certain events.

However, if you have any more tools for administrator command-line work in your hands, then do let me know in the comment section.

Till then, peace.

Join The Conversation

Users are always welcome to leave comments about the articles, whether they are questions, comments, constructive criticism, old information, or notices of typos. Please keep in mind that all comments are moderated according to our comment policy.