Send a Terminal Message with write Without Losing Your Place
write drops a live line straight onto a colleague's terminal, no chat app, no email, just text appearing on their screen. You will send a message from one Linux terminal to another logged-in user's terminal, confirm which terminal receives it, and close the exchange cleanly. This guide uses the write command shipped by util-linux 2.39.3 on this machine, from the bsdextrautils package.
The route
Jump straight to the step you need, or tick off Done means at the end.
Allow about five minutes for a two-terminal test. You need the target user's login name, access to a shell, and either a second terminal of your own or a willing recipient. No elevated privileges are needed for ordinary use.
1. Check the installed command
Start by confirming the command is available, and record the version if you are writing instructions or a script around it:
$ command -v write
/usr/bin/write
$ write --version
write from util-linux 2.39.3
The exact version line can vary on another distribution. What matters is that write resolves to an installed executable. This version accepts only the help and version options; the message itself is supplied as input after the user and optional terminal name.
2. Find the recipient and terminal
Use who to see logged-in users and the terminals they occupy:
$ who
alex pts/2 2026-09-28 10:14 (192.0.2.20)
alex pts/5 2026-09-28 10:16 (192.0.2.20)
Replace alex below with the actual login name. If that user appears once, let write choose the terminal. If they appear more than once, give the terminal name as the second operand, such as pts/5. Left to itself, the command picks the terminal with the shortest idle time, which may not be the one the person is actually watching.
Check the name and terminal one more time before sending anything sensitive. write copies what you type to a live terminal. It is not private messaging, encryption, or an audit trail.
3. Open the conversation
To address a user without choosing a terminal, run:
$ write alex
To select one of several terminals, run:
$ write alex pts/5
The recipient sees a header similar to:
Message from sam@host on pts/3 at 10:22 ...
The user and host in that header come from the current session. Do not copy the example literally: use the login and terminal values who gave you. Once connected, each line you enter is copied to the selected terminal. Press Enter after each line rather than composing a large block in another application.
4. End the exchange deliberately
When you have finished, send the terminal's end-of-file character. In a normal interactive shell, that means pressing Ctrl-D on an empty input line:
$ write alex pts/5
Please restart the import after 14:00
^D
The recipient should see EOF, meaning this side has closed the conversation. They cannot reply through the same process: they must run write back to you, using your login name and, if needed, your terminal from who.
The traditional convention is -o at the end of a line to mean the other person may take a turn, and oo to mean the conversation is over. These are conventions carried by the text, not options to the command. Agree on them before relying on them in a longer exchange.
5. Test it safely with two terminals
A second login of your own is the least surprising way to verify the route. In terminal A, identify both sessions:
$ who
sam pts/3 2026-09-28 10:20
sam pts/4 2026-09-28 10:21
In terminal A, target terminal B explicitly:
$ write sam pts/4
test message from terminal A
^D
Checkpoint
In terminal B, expect the sender header, the test line, then EOF. If the message arrives, repeat the test with sender and recipient reversed before using the command for real.
End a session with Ctrl-D, not by closing a terminal window while the command is still active. Interrupt it and the recipient may never see the normal EOF marker. Either way, there is no service left running and no message queue to clear afterwards.
6. Handle blocked or missing terminals
A user can disable incoming terminal messages with mesg. Programs such as nroff and pr may also disable writing temporarily so their output is not overwritten. The superuser is treated differently, but do not reach for elevated privileges as a routine workaround:
$ mesg
is y
$ mesg n
is n
$ mesg y
is y
These commands change whether other users may write to the current terminal, and are ordinary per-terminal settings that do not require sudo. Restore the previous setting when you are done: mesg n if you did not intend to receive messages, mesg y to allow them again.
If write reports the user is not logged in, rerun who and check the spelling. If the user is listed but the terminal is rejected, use the exact terminal name, including its pts/ prefix. If the recipient sees nothing, check the chosen terminal is still open and that its mesg setting permits messages.
Done means
- Command confirmed.
write --versionidentified the installed util-linux command. - Recipient confirmed.
whoconfirmed the recipient and, where needed, the exact terminal. - Nothing sensitive exposed. The message went out without placing secrets in a shared terminal.
- Exchange closed properly. It ended with an end-of-file character and the recipient saw
EOF. - Settings restored. Any temporary
mesgchange was put back to its previous setting.