Sending Messages to Logged-in Users

To send messages to users logged in even though they are not active. write command is pre-installed in all the Linux Distributions and allows us to send messages to another user in the terminal using tty2. After entering text click CTRL+D to exit when done, it’ll then send the text, but it isn’t a two-way conversation

$ write root tty2
"We're under Surveillance!!"

While executing to write the command if it doesn’t operate or if it is disabled, then use mesg command to turn it on. After which write command will be executed.

$ write root tty2
$ mesg

To give permission to the write command execute mesg y statement to enable write. The command mesg can also be used if the user doesn’t want to receive any messages or turning off the incoming messages.

$ mesg y
$ write root tty2

If the message or text is stored in a text file then use the cat utility function with the write command to send the text file to the user in order to send the message. The text file will be sent to all the users logged in irrespective of being active at that particular time. The user can view the message whenever they are active on the Terminal.

$ cat sample.txt | write root tty2

Make use of these commands and methods to send messages to currently logged-in users or users who are logged in but not active in the terminal.

How to Send a Message to Logged Users in Linux Terminal?

Linux is a solution to the data center. It is flexible, stable, secure, and reliable. There are many users logged into servers for development purposes, testing, and usage. There are various tools to send messages to other users, but they do not allow widespread sending or sending to specific users due to security issues, so we’re limited to sending messages via terminals. 

Similar Reads

Checking Active Users on Terminal

To view the active users on the system, use cat utility to get a list of users who are active or the users who are on the system....

Sending Messages to Currently Logged-in Users

To check who is currently logged in and on which terminal the user is logged in will be displayed when w command is executed. w command will display who has logged into the terminal and the actions they are performing....

Sending Messages to Logged-in Users

To send messages to users logged in even though they are not active. write command is pre-installed in all the Linux Distributions and allows us to send messages to another user in the terminal using tty2. After entering text click CTRL+D to exit when done, it’ll then send the text, but it isn’t a two-way conversation...

Syntax

Usage:...

Examples

1. Check the Current Status...

Send a Message to Logged Users in Linux Terminal – FAQs

How does message queue work in Linux?...