The commands discussed in this section are simple and familiar to most Unix users. For this reason, they're often overlooked in system administration discussions. However, I believe you'll find them to be an indispensable part of your repertoire. One other important communications mechanism is electronic mail (see Chapter 9).
A system administrator frequently needs to send a message to a
user's screen (or window).
one way to do so:
where username indicates the user to whom
you wish to send the message. If you want to
write to a user who is logged in more than
once, the tty argument may be
used to select the appropriate terminal or window. You can find out
where a user is logged in using the
command is executed, communication is established between your
terminal and the user's terminal: lines that you type on your terminal
will be transmitted to him. End your message with a CTRL-D. Thus, to
send a message to user harvey for which no reply
is needed, execute a command like this:
The file you needed has been restored.Additional lines of message text
In some implementations (e.g., AIX, HP-UX and Tru64),
write may also be used over a network by
appending a hostname to the username. For example, the command below
initiates a message to user chavez on the host
When available, the
command may be used to list all users on the local subnet (it requires
a remote who daemon be running on the remote system).
talk command is a more
sophisticated version of
formats the messages between two users in two separate spaces on the
screen. The recipient is notified that someone is calling her, and she
must issue her own
talk command to
begin communication. Figure
1-1 illustrates the use of
Users may disable messages from both
talk by using the command
mesg n (they can include it in their .
login or .
profile initialization file).
Sending messages as the superuser overrides this command. Be aware,
however, that sometimes users have good reasons for turning off
To send a message to all users, execute the command:
wallFollowed by the message you want to send, terminated with CTRL-D on a separate line
Unix then displays a phrase like:
Broadcast Message from root on console ...
to every user, followed by the text of your message. Similarly,
rwall command sends a message
to every user on the local subnet.
Anyone can use this facility; it does not require superuser
status. However, as with
talk, only messages from the
superuser override users'
commands. A good example of such a message would be to give advance
warning of an imminent but unscheduled system shutdown.
Login time is a good time to communicate certain types of information to users. It's one of the few times that you can be reasonably sure of having a user's attention (sending a message to the screen won't do much good if the user isn't at the workstation). The file /etc/motd is the system's message of the day. Whenever anyone logs in, the system displays the contents of this file. You can use it to display system-wide information such as maintenance schedules, news about new software, an announcement about someone's birthday, or anything else considered important and appropriate on your system. This file should be short enough so that it will fit entirely on a typical screen or window. If it isn't, users won't be able to read the entire message as they log in.
On many systems, a user can disable the message of the day by creating a file named . hushlogin in her home directory.
On Solaris, HP-UX, Linux and Tru64 systems, the contents of the file /etc/issue is displayed immediately before the login prompt on unused terminals. You can customize this message by editing this file.
On other systems, login prompts are specified as part of the terminal-related configuration files; these are discussed in Chapter 12.