Sep 5, 2023 4 min read

How to Use Wall Command on Linux

Use Wall Command on Linux with our step-by-step tutorial. Wall is a command-line utility that sends a message to all logged-in users' terminals.

Use Wall Command on Linux
Table of Contents

Introduction

Before we begin talking about how to use Wall Command on Linux, let's briefly understand – What is wall command?

wall is a command-line utility that sends a message to all logged-in users' terminals. The messages can be written into the terminal or stored in a file. To send a message to a specific user, use the write command instead of the wall command.

Typically, system administrators send out messages notifying users of scheduled maintenance and requesting that they log out and close all open programs. All logged-in users who have a terminal open will see the messages. The messages will not be visible to users who are using a graphical desktop environment and do not have a terminal open. With the mesg utility, each user can regulate who can write to their terminal. When the superuser issues the wall command, all users, regardless of message type, get the messages.

In this tutorial, you will use Wall Command on Linux. We will also address a few FAQs on how to use Wall Command on Linux.

Broadcast a Message

The following is the syntax for the wall command:

wall [OPTIONS] [<FILE>|<MESSAGE>]

Wall reads the message from standard input if no file is given.

The simplest approach to send a message out is to use the wall command with the message as the argument:

wall "The system will be restarted in 20 minutes."
Output

Broadcast message from [email protected] (pts/0) (Tue Jan 24 19:22:07 2022):

The system will be restarted in 20 minutes.

The message will be broadcast to all currently logged-in users.

💡
Run the w or who command to display all logged-in users.

Invoke the command with the -n (--nobanner) option to disable the banner and show only the text you type to logged-in users:

sudo wall -n "The system will be restarted in 20 minutes."
Output

The system will be restarted in 20 minutes.

Invoke the command without an argument if you want to write multi-line messages:

wall

The wall command will sit and wait for you to type something. When you're finished typing, use Ctrl+D to close the program and broadcast the message.

You can also pipe the output of another program to wall or use the here-string redirection. Here's an example of how to broadcast multi-line messages with the echo command:

echo "The system will be restarted in 20 minutes. \nPlease save your work."  | wall

Broadcast a Message From a File

If you send the same messages on a frequent basis, you can save each one to a file so, you don't have to type the same text over and over. When called a root, wall reads from the file.

Invoke the wall command followed by the file name to broadcast the contents of a file:

The system will be restarted in 20 minutes.
sudo wall message1_file.txt
Output

Broadcast message from [email protected] (pts/0) (Tue Jan  24 19:25:06 2022):

The system will be restarted in 20 minutes.

Broadcast a Message to a Group

Run the command with the -g (--group) option, followed by the group name, to deliver a message solely to members of a specific group. To write exclusively on the terminals of members of the "testers" group, for example, type:

wall -g testers "The system will be restarted in 20 minutes."

The GID of the group can also be used to specify it (group ID).

FAQs to Use Wall Command on Linux

How do I use the wall command to send a message to all users? 

To send a message using wall, simply type wall followed by the message text. Press Enter to send the message to all logged-in users.

Can I use the wall command to send a message as a privileged user? 

Yes, the wall command can be run with root or sudo privileges, allowing you to send messages as a privileged user to all users on the system.

Are there any limitations or restrictions when using the wall command?

By default, the wall command only works within a local network and requires permission to write to the terminal devices of other users.

How can I send a message to a specific user using the wall command? 

To send a message to a specific user, you can use the write command followed by their username, rather than using wall.

Is there a way to include a file's contents as a message using the wall command? 

Yes, you can use input/output redirection with the wall command to include a file's contents as the message, like wall < file.txt.

Can I use the wall command from a remote system to send a message? 

Yes, you can use tools like SSH or remote login to access a Linux system and run the wall command to send a message to logged-in users.

Is there a limit to the length or size of the message sent with the wall command?

Yes, the message length is typically limited by the terminal or virtual console size, and excessively long messages may get truncated or split.

Conclusion

The wall command displays a message on all presently logged-in users' terminals.

If you have any queries, please leave a comment below and we’ll be happy to respond to them.

Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to DevOps Tutorials - VegaStack.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.