Icon Celebrity Journal
general /

How to use the wall command on linux

How to use the wall command on linux

On Unix-like operating systems, the wall command writes a message simultaneously to all other logged-in users.

This page covers the Linux version of wall.

  • Description
  • Syntax
  • Examples
  • Related commands
  • Linux commands help

Description

wall displays the contents of file or, by default, its standard input, on the terminals of all currently logged-in users. The command will cut any lines that are over 79 characters to new lines. Short lines are white space padded to have 79 characters. The command always puts carriage return and new line at the end of each line.

Only the super-user can write on the terminals of users who have chosen to deny messages or are using a program which automatically denies messages.

Reading from a file is refused when the invoker is not superuser and the program is suid or sgid.

Syntax

Options

-n, –nobannerSuppress banner
-t, –timeout TIMEOUTWrite timeout to terminals in seconds. TIMEOUT must be positive integer. Default value is 300 seconds, which is a legacy from time when people ran terminals over modem lines.
-V, –versionDisplay version information and exit.
-h, –helpDisplay a help message and exit.

Examples

Using the sudo command to run wall as the superuser, sends the contents of message.txt to all users.

Related commands

mesg — Control if (non-root) users can send messages to your terminal.
talk — Talk with other logged in users.
write — Send a message to another user.
shutdown — Schedule a time for the system to be powered down.

wall command in Linux system is used to write a message to all users. This command displays a message, or the contents of a file, or otherwise its standard input, on the terminals of all currently logged in users. The lines which will be longer than 79 characters, wrapped by this command. Short lines are whitespace padded to have 79 characters. A carriage return and newline at the end of each line is put by wall command always. Only the superuser can write on the terminals of users who have chosen to deny messages or are using a program which automatically denies messages. Reading from a file is refused when the invoker is not superuser and the program is suid(set-user-ID) or sgid(set-group-ID).

Syntax:

Options:

  • wall -n: This option will suppress the banner.
  • wall -t: This option will abandon the write attempt to the terminals after timeout seconds. This timeout needs to be a positive integer. The by default value is 300 seconds, which is a legacy from the time when peoples ran terminals over modem lines.

Example:
wall -V : This option display version information and exit.

wall -h : This option will display help message and exit.

Need to get a quick message out to all logged-in users? Linux’s wall command is punchier than email and auto-targets the logged-in users. It broadcasts a message to everyone using a terminal on a system.

The wall Command

If you need to get a message out—fast—to the logged-in users of your computer, how do you do it? Email doesn’t satisfy the requirements. You don’t know when the email will be read. If you need people to know something right now, that doesn’t cut it. And anyway, you don’t want to clog up the inboxes of logged-out users who don’t need to see the message.

Without exerting a bit of extra effort and wasting some time, you’re not going to know who is logged in and from where. Your system could be located in Aberdeen, Washington but you might have remote users logged in from Aberdeen, Scotland. So how can you target a message specifically at the logged-in users?

Linux and other Unix-like operating systems give you a simple way to do this. The wall command is like a forceful telegram. It will deliver a message to all terminal users, and it dumps the message right under their nose. The users can’t miss it, and you know they’ve got it. You don’t need them to choose to open an application to see if they have a message waiting.

The delivery is as subtle as a custard pie in the face.

Sending A Message

The test machine that this article was researched on was installed with Fedora Linux, but the wall command will behave precisely the same on other distributions.

The one difference you might encounter is some Linux distributions require you to use sudo on the option for sending a message from a text file, while other distributions require you always to use sudo with wall all the time. That’s actually a difference between Linux distributions, not a difference to the operation of the wall command itself.

To send a message to all users, type wall , a space, then the message you wish to send. With Fedora Linux, you must use sudo .

How to use the wall command on linux

Your message will be sent out to all users who have a terminal window open.

Local users RIa and Tom receive the message, as does remote user Dick, who happens to be working on a computer running Ubuntu.

How to use the wall command on linux

How to use the wall command on linux

How to use the wall command on linux

They all get the message at the same time, and you’re not left wondering whether they’ve seen it.

Sending a Message From a File

You can prepare your message in a text file and store it ready to send. If you have a repeating cycle of messages that need to be sent, you can create a library of pre-packed messages so that you don’t need to re-type them again and again.

The message in the text file message.txt has been displayed to the terminal window with the cat command to make sure it is the one we want to send.

The message is then sent by passing the name of the text file to the wall command as a command line parameter:

How to use the wall command on linux

As before, local users Ria and Tom (and everyone else that is logged in with an open terminal window), and remote user Dick receive the message.

How to use the wall command on linux

How to use the wall command on linux

How to use the wall command on linux

Messaging Etiquette

Because the wall command will push the message out to all terminal users no matter what, it can be a jarring experience to receive one. Use of the wall command should be kept to a minimum and only used where there is a genuine need. Otherwise, it will rapidly become very grating.

A wall message will stamp over whatever else is on the user’s terminal. It doesn’t actually overwrite anything–it won’t change the text it has landed on top of—but it will obscure it. And that can be alarming for a user that doesn’t know this.

Imagine one of our local users is editing an important file in Vi just as the wall message is sent.

How to use the wall command on linux

The message arrives right in the middle of her file.

How to use the wall command on linux

All our user needs do to restore the correct view of the file is to page up and down a little way through the file.

How to use the wall command on linux

It’s easy enough to restore the display to a state where work can continue, and blood pressure can recede, but too many interruptions of that sort are going to leave you with a very riled set of users.

So, as handy as wall is, use it in considered moderation.

What About Graphical Desktop Users?

The wall command reaches everyone logged in with a terminal open, but it won’t reach anyone who’s using a graphical desktop environment without a terminal window open.

If someone is using a graphical desktop and has a terminal window open, they’ll see it in the terminal window—but that’s it. Don’t count on wall to reach anyone outside of the terminal.

Subtle it isn’t, but you can’t deny it does get the message across—in a traditional terminal environment, that is.