Write (Unix)

{{Short description|Unix command to send messages to another user by writing directly to their terminal}}

{{About|the Unix command|the system call|write (system call)}}

{{Primary sources|date=August 2016}}

{{lowercase}}

{{Infobox software

| name = write

| logo =

| screenshot =

| screenshot size =

| caption =

| author = Dennis Ritchie,
Ken Thompson

| developer = AT&T Bell Laboratories

| released = {{Start date and age|1971|11|3}}

| latest release version =

| latest release date =

| operating system = Unix and Unix-like

| platform = Cross-platform

| genre = Command

| license =

| website =

}}

In Unix and Unix-like operating systems, {{mono|write}} is a utility used to send messages to another user by writing a message directly to another user's TTY.{{man|1|write|v7}}

History

The write command was included in the First Edition of the Research Unix operating system.{{cite book|title=Unix Programmer's Manual|date=3 November 1971|publisher=Bell Labs|page=write(1)|edition=1st|url=http://www.bell-labs.com/usr/dmr/www/man14.pdf|access-date=9 July 2016|archive-url=https://web.archive.org/web/20160709075913/http://www.bell-labs.com/usr/dmr/www/man14.pdf|archive-date=9 July 2016}} A similar command appeared in Compatible Time-Sharing System.{{cite book |last=Fetter |first=Mirko |date=2019 |title=New Concepts for Presence and Availability in Ubiquitous and Mobile Computing |url=https://books.google.com/books?id=knqIDwAAQBAJ&dq=%22ctss%22+%22write+command%22&pg=PA38 |publisher=University of Bamberg Press |page=38 |isbn=9783863096236 |quote=The basic concept of sending instantaneously messages to logged in users came with ... CTSS ...}}

Sample usage

The syntax for the write command is:

$ write user [tty]

message

The write session is terminated by sending EOF, which can be done by pressing Ctrl+D. The tty argument is only necessary when a user is logged into more than one terminal.[https://www.mankier.com/1/write write(1) – util-linux man page]

A conversation initiated between two users on the same machine:

$ write root pts/7

test

Will show up to the user on that console as:

Message from root@wiki on pts/8 at 11:19 ...

test

See also

{{Wikibooks|Guide to Unix|Commands}}

References