How to Use the wall Command in Linux

February 18, 2021

Introduction

Scenarios in which multiple users use SSH to work on a server simultaneously are common in the Linux world. When system administrators perform system maintenance tasks, they need a quick way to inform users they should save their work and log out.

In this tutorial, you will learn how to use the wall command in Linux. This command allows sending terminal messages to all logged in users at once.

How to Use the wall Command in Linux

Note: wall is a terminal-based command. Users working in a GUI without a terminal window open will not see wall notifications.

Prerequisites

  • A system running Linux
  • Access to the command line

What Does the wall Command Do?

wall is short for write to all. The purpose of the command is to send a quick message to the terminals of all currently logged in users.

Linux wall Command Syntax

The syntax of wall is straightforward. The command is followed by options and either the text of the message or a filename:

wall [options] [message-text/filename]

wall Command Examples

Below is a list of all the options wall takes, along with examples of the command use.

Broadcast a Message

The basic way to use the Linux wall command is to type it before a message you want to send, without any added options.

wall [message-text]
Sending a message to logged-in users using the wall command

The users receive the message in the following format:

The look of the message send with the wall command in the user terminal

Note: Use the wall command sparingly. It was designed for communicating essential pieces of information, so it reaches all the logged in users under all conditions. Frequently using the command when there is no need for it may disrupt the workflow for some users.

Add a Timeout to a Message

If the contents of the message become irrelevant after a certain period, use the -t (--timeout) option to limit the time during which the system attempts to deliver the message:

wall -t [time-in-seconds] [message-text]
Using the -t option with the wall command to create an expiring message

Users who log in after the allotted time expires do not receive the message.

Broadcast a Message Without the Header

To exclude the header text preceding the message, use the -n (--nobanner) option:

wall -n [message-text]
Sending a message to logged-in users using the wall command with the -n option to remove the header

The system now displays only the contents of the message:

The look of the message sent with the wall -n command in the user terminal

Write Multi-line Messages

1. To write a message containing multiple lines, type the wall command and press Enter. The terminal provides the user with space to enter the message.

2. Once you finish writing, press Ctrl+D to end the input and send the message.

wall 

[message-line-1]

[message-line-2]...

Sending a multiple-line message using the wall command

The system displays the multi-line message on the users’ screens:

Receiving a multiple-line message send with the wall command

Broadcast a Message from a File

To use text contained in a file as the wall message, write the filename after the wall command:

wall [filename]

The output for the users receiving the message looks the same as in the previous examples:

Receiving a message sent with the wall command using a text file

Broadcast a Message to a Group

Limit the reach of the wall command to include only a certain group of users by using the -g (--group) option:

wall -g [group-name] [message-text]
Sending a message to members of a group using the wall command with the -g option

In the example above, only the users belonging to testgroup receive the message.

Use the wall Command with echo

Another way to send a message using wall is to pipe the output of  the echo command into wall using the following syntax:

echo "[message-text]" | wall

Display Version Information and Help

Use the -V (--version) option to see the installed wall utility’s version information:

wall -V

The -h (--help) option lists all wall command options:

wall -h

Conclusion

After reading this tutorial, you should understand how to use the wall command in Linux. The tutorial covered all available options and offered practical examples of using the command.

Was this article helpful?
YesNo
Marko Aleksic
Marko Aleksić is a Technical Writer at phoenixNAP. His innate curiosity regarding all things IT, combined with over a decade long background in writing, teaching and working in IT-related fields, led him to technical writing, where he has an opportunity to employ his skills and make technology less daunting to everyone.
Next you should read
Echo Command in Linux (With Examples)
February 11, 2021

The echo command prints out a text string you provide as the output message. This tutorial covers the echo...
Read more
How to Use the Linux xargs Command
February 11, 2021

While some Linux commands take input both from the standard input (stdin) and as a command-line argument...
Read more
How to Use the Linux tee Command
January 28, 2021

https://phoenixnap.com/kb/linux-tee By default in Linux, a command received through standard input writes directly to standard output...
Read more
Linux Commands Cheat Sheet: With Examples
February 21, 2020

A list of all the important Linux commands in one place. Find the command you need, whenever you need it or...
Read more
  • © 2021 Copyright phoenixNAP | Global IT Services. All Rights Reserved.