Last Updated : 11 Jul, 2025
The `write` command in Linux facilitates the users in sending the messages directly to other logged-in users' terminals. For using this command, try on to type `write username` and then type your message. After typing your message, press `Ctrl+D` to end the session. This command is useful for quick communication between users on the same system.
In this article, we will guide you on what the write command is, how to use it, discuss effectively when to use it, and its common usage examples.
What is write command in Linux?The Command in Linux is used to send a message to another user. The write utility allows a user to communicate with other users, by copying lines from one user's terminal to others. When you run the write command, the user you are writing to gets a message of the form:
Message from yourname@yourhost on yourtty at hh:mm ...
Any further lines the user enter will be copied to the specified user's terminal. If the other user wants to reply, they must run write as well. When you are done, type an end-of-file or interrupt character. The other user will see the message ‘EOF’ indicating that the conversation is over.
Syntaxwrite user [tty]Options of Write Command
The following are the options of write command in Linux:
Option Descriptionwrite username
Sends a message to the specified user's terminal. write username tty
Sends a message to the specified user's terminal on a specific terminal device. Ctrl+D
Ends the message input session. mesg y
Allows messages from other users (enables write access). mesg n
Disallows messages from other users (disables write access). When to use write command in Linux?
The following are the some of the insights on when to use the write command in linux:
On using the write command without any option comes with displaying the usage of its general syntax and usage guidelines. It helps in providing the users with essential information on how to format and structure their messages when using the write command to communicate with other users on the system. This basic usage helps the users in quickly grasping on how to initiate the inter-user communication via terminal sessions, fostering the efficient collaboration and system wide messaging capabilities.
Example and Usage of write Commandwrite metal: In this command metal is the name of another user that I'm logged in with and when I execute this command with a message I get a notification on my terminal showing that I received a message from another user.
write metalExplanation
So the basic use case of the write command is to send messages to the users on the other terminal as a way to interact. Once you enter write command and type your message then every user that is logged in will get a pop-up message. You will also receive a message from this particular user so if any other user wants to broadcast his message he can do the same.
How does Write Command Works?The write
command in Linux facilitates that one user to send a message directly to another user's terminal session. When a user executes the write username
, the system establishes a direct communication line to the specified user’s terminal. The sender can type a message, which is immediately displayed on the recipient's terminal. The session ends when the sender inputs Ctrl+D
.
The following are the some of the insights on its workflow:
write username
.write username tty
.Ctrl+D
.mesg y
or mesg n
.write john
initiates a session to send a message to user "john".The following are the some of the examples of write command:
1. Basic Usagewrite john2. Specify Terminal
hello john, are you available for a meeting?
write alice tty23. Interactive Messaging
Hi Alice, please review the latest changes.
write -i peterDifference between write and execute in Linux
The following are the difference between write and execute in Linux:
Aspect Write Permission Execute Permission Function Allows modifying or editing a file Allows running a file as a program or script File Interaction Users can add, delete, or alter file content Users can execute or run the file Directory Interaction Users can add or remove files within the directory Users can access and traverse the directory Command Examplechmod
+w filename
(to add write permission) chmod +x filename
(to add execute permission) Symbol Represented by w
in the permission string Represented by x
in the permission string Features of write command
The following are the features of write command:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4