By KFSys
System Administrator
I’ve recently had a case where I needed to talk with another user that was connected to the Droplet with SSH which prompted me to write this quick mini-tutorial.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Accepted Answer
To communicate with another user who is connected to the same server via SSH, you can use several command-line utilities available on most Unix-like systems. The most commonly used commands for sending messages to other users on the same server are write
, wall
, and talk
. Here’s how to use each of them:
write
CommandThe write
command sends a message to another user who is logged in by specifying their username and the terminal name (if they are logged in multiple terminals). You can see the terminals with the who
command.
who
This command shows a list of all logged-in users, their terminals, and other login info.
Send a message:
write username tty
username
with the user’s username and tty
with their terminal name from the who
output. After executing the command, you can start typing your message. Finish by pressing CTRL+D
to end the message.wall
CommandThe wall
(write all) command sends a message to all logged-in users. This is particularly useful for sending system-wide notifications.
wall "Your message here"
wall
followed by your message enclosed in quotes. You might need superuser privileges depending on your system’s configuration.talk
CommandThe talk
command allows a two-way interactive communication between two users.
Initiate a talk session:
talk username [tty]
username
with the user’s username. The tty
is optional if the user is logged in at more than one terminal. The user on the other end will see a message asking if they accept the talk request.mesg
CommandBefore using write
or talk
, it’s good practice to check if the user has allowed messaging through the mesg
command. Users can control whether they receive messages from other users with this command.
mesg y # Enable
mesg n # Disable
Here is a practical example of how to use these commands:
who
write
:write johndoe pts/1
wall
:sudo wall "Server will restart in 10 minutes."
talk johndoe pts/1
Remember that for write
and talk
, the user must have their message setting enabled (mesg y
). These methods are straightforward for quick and direct text-based communication on servers where multiple users are logged in via SSH.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.