Skip to main content
SysAdmin Shell Scripting Essentials

netwall (Linux wall) Syntax, Examples & Troubleshooting

netwall is the Linux command equivalent to wall that instantly sends a message to every user’s terminal, used for maintenance notifications and emergency broadcasts.

wall [options] [message]
wall [options] < file
wall [options] --group group_name [message]

Tested on Ubuntu 22.04 LTS with coreutils 8.32.

What is netwall and when to use it?

wall broadcasts a message from stdin or a file to all terminals of logged-in users, except those with mesg n. System administrators use it before reboots or downtime to warn users. Unlike write (single user), wall is a broadcast. The shutdown -k command sends fake warnings, but wall provides precise message control without initiating shutdown.

Syntax

wall [options] [message]
wall [options] < file
wall [options] --group group_name [message]

If no message is supplied on the command line, wall reads from standard input until EOF.

Options and Flags

Flag Type Default Description
-n, --nobanner boolean off Suppress the default banner (hostname, date, user) at the top of the message.
-t, --timeout integer (seconds) 0 (no timeout) Maximum time to wait for writing to each terminal. If a terminal does not respond within the timeout, it is skipped.
-g, --group string none Only send message to users who are members of the specified group.
--version boolean N/A Display version information and exit.
-h, --help boolean N/A Display help text and exit.
-V alias N/A Same as --version.

netwall Command Cheat Sheet

Action CLI Command Key Flag Description
Broadcast a simple message wall "System will reboot in 5 minutes" N/A Sends quoted string to all terminals.
Send message from a file wall < /etc/motd N/A Redirect file content as the broadcast message.
Suppress banner wall -n "Maintenance in progress" -n Removes the header line (hostname, time, user).
Set a write timeout wall -t 2 "Save your work!" -t Skip terminals that are slow or unresponsive after 2 seconds.
Broadcast to a specific group wall -g developers "Code freeze in 10 minutes" -g Only users in the developers group receive the message.
Multi-line message via heredoc wall << EOFnLine1nLine2nEOF N/A Reads multiple lines from stdin until delimiter.
See also  Django help_text Field Attribute: Syntax, Examples, and Best

Usage Examples

Example 1: Emergency Reboot Warning

wall -n -t 3 "CRITICAL: System will reboot in 2 minutes. Please save all work."

Execution context: This command suppresses the banner (-n) and sets a 3-second timeout per terminal (-t 3). Any terminal that does not accept the write within 3 seconds is skipped, preventing the command from hanging on a stuck session. Best used during automated reboot scripts.

Example 2: Sending a Message from a File

cat > /tmp/maintenance.txt << EOF
Scheduled downtime begins at 22:00 UTC.
Backup your data before then.
EOF

wall < /tmp/maintenance.txt

Execution context: Pre-writing a multi-line notice to a file allows reuse across multiple sessions or integration with cron jobs. Using input redirection avoids quoting issues for long messages.

Example 3: Group-Specific Notification

wall -g sudo "Passwordless sudo will be disabled in 24 hours. See IT policy."

Execution context: Targets only users in the sudo group. Membership is resolved at runtime via getgrnam. Useful for sending policy changes to administrative users without disturbing regular users.

Troubleshooting & Common Errors

Error Message / Code Root Cause Resolution Command
wall: can't open /dev/tty0: Permission denied User is not root or not in the tty group; wall requires write access to device files. sudo wall "message" or add user to tty group: usermod -aG tty $USER
wall: writing to terminal /dev/pts/2: Input/output error Terminal session is disconnected or in a bad state. Timeout flag: wall -t 1 "msg" to skip problematic terminals.
Message not received by some users Users have disabled messaging via mesg n. Check mesg status per user; cannot override. Use alternative broadcast like echo message > /dev/pts/* (but requires root).
Exit code 1 with no specific error output One or more terminals rejected the write, but others succeeded. Use strace wall ... to identify specific failing terminals. Increase timeout or skip using -t.

Frequently Asked Questions

What is the difference between the --nobanner and --group flags?

Answer: --nobanner (-n) suppresses the header line (hostname, date, user) from the broadcast. --group (-g) restricts the broadcast to users in a specified group. They can be combined: wall -n -g admins "Message". Example: wall -n -g sudo "Maintenance in 5 minutes".

How do I use the --timeout flag?

Answer: Use -t seconds to set a maximum time to write to each terminal. If a terminal does not respond within that time, it is skipped. This prevents wall from hanging on unresponsive SSH sessions. Example: wall -t 2 "Quick notice".

Can I use wall in a script without interactive input?

Answer: Yes, pass the message as an argument or redirect from a file. For multi-line messages, use a heredoc: wall << EOFnLine1nLine2nEOF or pipe from echo: echo "Rebooting in 10 minutes" | wall.

Does wall work on all Linux distributions?

Answer: Yes, wall is part of util-linux and is available on Debian, Ubuntu, RHEL, Fedora, Arch, and other major distributions. Flags -n, -t, -g are standard. Check with wall --help for version-specific support.