LinuxCommandLibrary

bsd-write

Send messages to another logged-in user

SYNOPSIS

write user [ttyname]

PARAMETERS

user
    Required: username of the logged-in recipient.

ttyname
    Optional: specific terminal (e.g., tty2, pts/3) if user has multiple sessions.

DESCRIPTION

write, often referred to as bsd-write in Linux contexts, is a classic utility for sending real-time messages to another user's terminal session. Originating from BSD Unix, it enables direct, interactive communication between logged-in users on the same multi-user system.

Invoke it by specifying the target username, optionally with a ttyname if the user has multiple sessions (discoverable via who or finger). Upon execution, the command attaches to the recipient's terminal, displaying a header like "Message from yourname@yourtty on yourtty at hh:mm ...". Anything you type is echoed locally and transmitted line-by-line to their screen upon Enter.

The interaction is synchronous and blocking; both parties see inputs in real-time. Tabs pass through unchanged, while other control characters render as question marks for safety. To exit gracefully, enter a line containing only a tilde (~) followed by Enter (quits silently), or a period (.) (sends EOF notification). The recipient can respond by running write back to you.

It's ideal for quick alerts like "lunch soon" but requires both users to be on ttys (not GUI sessions). Blocked if recipient runs mesg n. Simple, lightweight, and permission-aware via tty access controls.

CAVEATS

Requires write permission on recipient's tty (check with ls -l /dev/tty*). Blocked by mesg n. Ineffective on GUI sessions or SSH without ttys. Interrupts recipient's work; use sparingly. No options in standard BSD/Linux impl.

CONVERSATION TERMINATION

End with line containing only ~
(silent exit) or .
(sends EOF to recipient).

IDENTIFYING SESSIONS

Use who or w to list users and ttys before invoking.

HISTORY

Introduced in early 4BSD (circa 1980) as part of Unix-to-BSD user tools for ttys-based collaboration. Precedes talk(1); standardized in POSIX.1 but minimally; Linux util-linux maintains BSD-compatible version since 1990s.

SEE ALSO

mesg(1), wall(1), talk(1), who(1), finger(1)

Copied to clipboard