The write
command is used to send messages to other users logged in on the same system. It is often used by system administrators to communicate with other users or to send important messages to all logged-in users.
Overview
The write
command is followed by the username of the user you wish to send a message to, and then the message itself. For example, to send a message to a user named “john”, you would use the following command:
write john Hello, how are you?
Once you hit enter, the message “Hello, how are you?” will be sent to the terminal of the user “john”. The user will see the message appear on their screen, along with your username and the time the message was sent.
If you want to send a message to all users logged in to the system, you can use the wall
command instead. This will send a message to all users, regardless of whether they are logged in locally or remotely. For example:
wall System maintenance will begin in 30 minutes. Please save your work and log out.
Options
The write
command has the following options:
Option | Description |
---|---|
-n |
Do not send a newline character at the end of the message. |
-t |
Specify the number of seconds to wait for a response from the user before timing out. |
Troubleshooting Tips
If you receive an error message that says “write: cannot find user”, it means that the user you are trying to send a message to is not currently logged in to the system. Make sure you have the correct username and that the user is currently logged in before trying again.
If you are unable to send a message to a user, it may be because they have disabled the ability to receive messages. Users can disable this feature by using the mesg
command with the -n
option. If you encounter this issue, you may need to contact the user through another means of communication.
Notes
- The
write
command can be a useful tool for system administrators to communicate with other users on the system. - Messages sent with the
write
command are not encrypted, so it is not recommended to send sensitive or confidential information through this method. - Users can disable the ability to receive messages with the
mesg
command.