×

Search anything:

wall command in Linux

Binary Tree book by OpenGenus

Open-Source Internship opportunity by OpenGenus for programmers. Apply now.

Linux is a multiuser system and as such there are occasions as system administrators we want to send a message to all logged-in users seamlessly, in this case, we use the wall command.

Table of contents:

  1. Introduction.
  2. Syntax.
  3. Commands.
  4. Summary.

Introduction.

Linux is a multiuser operating system, therefore, we expect multiple users working on a system simultaneously. As system administrators, there are situations that require us to send messages to all logged-in system users, for example, system upgrades and maintenance, hardware replacements, etc.
In Linux, we have the wall command, we use it to print out information on the terminals of logged-in users.

Syntax.

The syntax of the command is as follows:

$ wall [OPTIONS] [MESSAGE OR FILE]

wall1

Commands.

To get started, let's execute the command without any options:

$ wall

wall3
After execution, we can write a message we want to send to system users in the standard input.
After we are done, the message will be sent to all logged-in users.
To terminate this, we press CTRL + D.

On the logged-in user's terminal session, the message is printed out.
wall3-1
This can also be used as a way to send multi-line messages to users.

To send a message to all logged-in users we can also pass the message as an argument to the command:

$ wall The system will be restarted in 1hour for updates.

wall4
Here we sent a message to all logged-in users informing them that the system will be restarted after 1 hour so that updates can take place.
wall4-1
Keep in mind that users can opt to deny messages to their terminals by using the mesg command and therefore we have to run this command as a superuser.

We can compose a message in a file and send it or maybe we have a file that contains a message we repeat occasionally. To use wall command with a file we pass the file as an argument to the command as follows:

$ sudo wall [File name]

wall5

On the user's side:
wall5-1

In Linux users are organized into groups for easier management. For example, we can have a group marketing which is only allowed to access certain types of files or use certain types of services. We can use the wall command to send a message to a group of users.
To send a message to the sudo group we write:

$ sudo wall -g sudo [Message/File]

wall6

Now on any users who belong to the sudoers group will receive this message:
wall6-1

Notice from the commands how there is a top banner with the date, we can decide to eliminate it by using the --nobanner option as follows:

$ sudo wall --nobanner [Message/File]

wall7
Now, all logged-in users will get the message but this time without the banner on top.
wall7-1

Sometimes, the messages are urgent and after a specific period, it is futile to keep sending them to logged-in users. In this situation we can set a timeout using the -t, this will mean that after the specified time, the computer will not attempt to send any more messages.

$ wall -t [time] [Message]

Here, all users who log in after x seconds will not receive this message.

Apart from the above-mentioned ways to get our messages to users who are currently logged in, we can also pipe the output of the echo command to the wall command:

echo "This message" | wall

wall8

An on the user's side:
wall8-1

Or write a here string:

wall <<< "This is a message"

wall9

On the logged in users' screens:
wall9-1

Summary.

Although its usefulness, this command can present issues because when executed, it displays the administrator's message over whatever the currently logged-in user is doing, be it, editing a config file or any other important task. Of course, the user can restore things to how they were before but more of these interruptions are not as pleasing.

Also, this command is limited to users on a terminal session, users currently using a GUI will not receive the message.

References.

For other wall command options we can check out its man page $ man wall

wall command in Linux
Share this