wall Command in Linux | Explained

Linux provides one of the best network interfaces with fantastic features, mainly through its terminal. One of their most valuable is the wall command, which sends a direct message or text from a file to all the users currently logged in. Only the superuser or admin can do this, and it is an excellent command to send the warning messages like “the server will restart in 10 minutes” or something like that.

This article will help users understand everything about the wall command of Linux, and we’ll use a few examples to elaborate on it more clearly. The content of the post is as follows:

That’s all from this guide!

What is the wall Command in Linux?

wall command, as discussed earlier, is used by the admin to send a text to all the logged-in users, and it only works with the terminal open, so you will not receive anything if the terminal is closed. There are a few variations, as below.

Syntax

The syntax of the wall command is pretty much straightforward, like all other commands, as seen below.

wall [options] [message | file]

The Options supported by it are as follows:

OptionsFunction
-g or –groupTo send the messages/file contents to a group of users.
-n or –nobannerUsed to remove the banner (unwanted or irrelevant text)
-t or –timeoutSets the timeout in seconds.

For more details on the usage of the wall command, use the following command:

$ wall --help

let’s practice this command in the upcoming command!

How to Use the wall Command in Linux?

This section lists examples of the wall command to send “wall” messages to other logged-in users. Before that, check the version of the wall command on your system via the below command:

$ wall --version

Let’s start with the examples!

Example 1: Send a Simple Message (Without Options)

Here is how the admin or superuser can send a message to other users. An admin or a user who run this command won’t be able to see the displayed message, but other users who are on the same network can see it.

$ wall the message to be delivered

The message sent from [email protected](admin) and all other users would see on their terminals are as follows.

Example 2: Send a Message From a File Using the wall Command

In some scenarios, any operation must be performed on the system frequently. To tackle this, a message text can be stored in a file, and the need to write the message again and again, is nullified. For instance, if a restart message is stored in a file, then the following syntax can be used to fetch and send the message:

Syntax:

$ sudo wall <path/of/the/file>

The “path/of/the/file” represents the file from where the message is to be fetched. Let’s practice this!

In our case, we used the “cat” command first to print the content of the file, and then the file command was utilized to send the message:

$ cat test 
$ sudo wall test

We used the “cat command” to show the file contents as in the above image.

Other logged-in users would see the output like this on their terminal screen.

Example 3: Send a Message to a Specific Group Using the wall Command in Linux

Suppose there are two servers in your working environment, and one of them needs to restart. Each server has a group of users, and you need to send those users a warning message before rebooting the system. It can be done using the wall command in the following syntax.

$ wall -g [group] [message]

The “editorial” is the group whose members will receive the message, as seen above.

Example 4: Suppress Banner in wall Command on Linux

As in the image below, you can see a lot of unwanted text known as a banner; it can be removed by adding “-n” to the wall Command.

The syntax of the wall command with “-n” is as follows.

$ wall -n <Your Message to be delivered>

And all the users would receive the messages from the admin or superuser just as intended.

That’s all from this guide!

Conclusion

The wall command, as the name directs, sends a message to all the currently logged-in users. This utility is mostly used by the network/system administrator to convey any warning or the action being performed on the server. This post has briefly demonstrated the working and usage of the wall command in Linux with the help of suitable examples.