The Wayback Machine - https://web.archive.org/web/20240118183124/https://www.geeksforgeeks.org/write-command-in-linux-with-examples/
Open In App
Related Articles

write command in Linux with Examples

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report

write 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.

Syntax:

write user [tty]

write command without any option: It will print the general syntax of the write. With the help of this, the user will get a generalized idea about how to use this command since there nothing like help option for the write command.

Example:

  • write 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 metal

    Explanation: 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.

Learn to code easily with our course Coding for Everyone. This course is accessible and designed for everyone, even if you're new to coding. Start today and join millions on a journey to improve your skills!

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Commit to GfG's Three-90 Challenge! Purchase a course, complete 90% in 90 days, and save 90% cost click here to explore.
Last Updated : 15 Apr, 2019
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads