How to Send a Message to Logged Users in Linux Terminal

How can I send a messages to logged on users in a Linux server? If you are asking this question, then this guide will help you learn how to do that. We will demonstrate how to send a message to all or a specific logged on user, on the terminal in Linux.

Linux offers a variety of means for sending messages to users logged on to a server as explained in the two methods below.

In the first method, we will use wall command – write a message to all currently logged in users on the terminal as shown.

# wall "System will go down for 2 hours maintenance at 13:00 PM"
Send Message to Logged Users
Send Message to Logged Users

To disable the normal banner printed by wall, for example:

Broadcast message from root@tecmint (pts/2) (Sat Dec  9 13:27:24 2017):

Add the -n (Suppress the banner) flag, this however, can only be used by the root user.

# wall -n "System will go down for 2 hours maintenance at 13:00 PM" 

In the second method, we will use write command, which comes pre-installed on all if not most Linux distributions. It allows you to send a message to another user in the terminal using tty.

First check the all logged on users with the who command as shown.

$ who
Find Logged in Users
Find Logged in Users

There are currently two users are active on the system (tecmint and root), now the user aaronkilik is sending a message to the root user.

$ write root pts/2	#press Ctrl+D  after typing the message. 
Send Message to User
Send Message to User

Read Also:

  1. Show a Custom Message to Users Before Linux Server Shutdown
  2. Protect SSH Logins with SSH & MOTD Banner Messages

That’s all! Do share with us other methods or commands for sending messages to all logged on users through the terminal in Linux. If you have any queries, please use the feedback form below.

Hey TecMint readers,

Exciting news! Every month, our top blog commenters will have the chance to win fantastic rewards, like free Linux eBooks such as RHCE, RHCSA, LFCS, Learn Linux, and Awk, each worth $20!

Learn more about the contest and stand a chance to win by sharing your thoughts below!

Aaron Kili
Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

10 Comments

Leave a Reply
  1. Here is a single-line curl command in the Linux terminal to send SMS text messages.

    curl -i --user username:password -d "number=19179362841&message=hello world!" https://textgun.io/send-sms with https://textgun.io.

    Reply
  2. Here is a very simple onliner to send SMS text messages using curl

    curl -i --user username:password -d "number=19179362841&message=hello world!" https://textgun.io/send-sms

    Reply
  3. Another way to send text to a terminal is with echo "some text" > /dev/ttyX (where X is the number of the destination terminal). It also works in virtual terminals by changing /dev/ttyX to /dev/pts/X.

    To send multi-line messages you can do the following: echo -e 'some\ntext' > /dev/ttyX

    Reply
  4. Interesting, but…

    What happens if the targeted user logged in on a GUI? I’m using Ubuntu 17.04 with Cinnamon desktop.

    The opened terminals aren’t receive messages sent by wall. Even if I enable receiving with “mesg y”. Why?

    And why I get these messages on the console if I disable them with “mesg n” (mesg n is the default)

    Reply
    • @HZ

      If a targeted user logged in from the GUI, then he or she may not see the message. You can only see the message if your terminal emulator is running by the time it is sent. Lastly, if the superuser(root) is sending the message, even if a normal user sets “mesg n”, he or she will see the mesg. But it will block one normal user’s message to another normal user.

      Hope you understand this explanation.

      Reply
      • If you have KDE a notification will pop up with the contents of the global message, just check that you don’t have do not disturb turned on

        Reply

Got Something to Say? Join the Discussion...

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.