xref: /freebsd/usr.bin/msgs/msgs.1 (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
1.\" Copyright (c) 1980, 1990, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\" 3. Neither the name of the University nor the names of its contributors
13.\"    may be used to endorse or promote products derived from this software
14.\"    without specific prior written permission.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\" SUCH DAMAGE.
27.\"
28.Dd August 8, 2018
29.Dt MSGS 1
30.Os
31.Sh NAME
32.Nm msgs
33.Nd system messages and junk mail program
34.Sh SYNOPSIS
35.Nm
36.Op Fl fhlpq
37.Op Ar number
38.Op Ar \-number
39.Nm
40.Op Fl s
41.Nm
42.Op Fl c
43.Op \-days
44.Sh DESCRIPTION
45The
46.Nm
47utility is used to read system messages.
48These messages are
49sent by mailing to the login `msgs' and should be short
50pieces of information which are suitable to be read once by most users
51of the system.
52.Pp
53The
54.Nm
55utility is normally invoked each time you login, by placing it in the file
56.Pa .login
57(or
58.Pa .profile
59if you use
60.Xr sh 1 ) .
61It will then prompt you with the source and subject of each new message.
62If there is no subject line, the first few non-blank lines of the
63message will be displayed.
64If there is more to the message, you will be told how
65long it is and asked whether you wish to see the rest of the message.
66The possible responses are:
67.Bl -tag -width Fl
68.It Fl y
69Type the rest of the message.
70.It Ic RETURN
71Synonym for y.
72.It Fl n
73Skip this message
74and go on to the next message.
75.It Fl
76Redisplay the last message.
77.It Fl q
78Drop out of
79.Nm ;
80the next time
81.Nm
82will pick up where it last left off.
83.It Fl s
84Append the current message to the file ``Messages'' in the current directory;
85`s\-' will save the previously displayed message.
86A `s' or `s\-' may
87be followed by a space and a file name to receive the message replacing
88the default ``Messages''.
89.It Fl m
90A copy of the specified message is placed in a temporary
91mailbox and
92.Xr mail 1
93is invoked on that mailbox.
94Both `m' and `s' accept a numeric argument in place of the `\-'.
95.El
96.Pp
97The
98.Nm
99utility keeps track of the next message you will see by a number in the file
100.Pa \&.msgsrc
101in your home directory.
102In the directory
103.Pa /var/msgs
104it keeps a set of files whose names are the (sequential) numbers
105of the messages they represent.
106The file
107.Pa /var/msgs/bounds
108shows the low and high number of the messages in the directory
109so that
110.Nm
111can quickly determine if there are no messages for you.
112If the contents of
113.Pa bounds
114is incorrect it can be fixed by removing it;
115.Nm
116will make a new
117.Pa bounds
118file the next time it is run with the
119.Fl s
120option.
121If
122.Nm
123is run with any option other than
124.Fl s ,
125an error will be displayed if
126.Pa /var/msgs/bounds
127does not exist.
128.Pp
129The
130.Fl s
131option is used for setting up the posting of messages.
132The line
133.Pp
134.Dl msgs: \&"\&| /usr/bin/msgs \-s\&"
135.Pp
136should be included in
137.Pa /etc/mail/aliases
138(see
139.Xr newaliases 1 )
140to enable posting of messages.
141.Pp
142The
143.Fl c
144option is used for performing cleanup on
145.Pa /var/msgs .
146A shell script entry to run
147.Nm
148with the
149.Fl c
150option should be placed in
151.Pa /etc/periodic/daily
152(see
153.Xr periodic 8 )
154to run every night.
155This will remove all messages over 21 days old.
156A different expiration may be specified on the command line to override
157the default.
158You must be the superuser to use this option.
159.Pp
160Options when reading messages include:
161.Bl -tag -width Fl
162.It Fl f
163Do not say ``No new messages.''.
164This is useful in a
165.Pa .login
166file since this is often the case here.
167.It Fl q
168Queries whether there are messages, printing
169``There are new messages.'' if there are.
170The command ``msgs \-q'' is often used in login scripts.
171.It Fl h
172Print the first part of messages only.
173.It Fl l
174Cause only locally originated messages to be reported.
175.It Ar num
176A message number can be given
177on the command line, causing
178.Nm
179to start at the specified message rather than at the next message
180indicated by your
181.Pa \&.msgsrc
182file.
183Thus
184.Pp
185.Dl msgs \-h 1
186.Pp
187prints the first part of all messages.
188.It Ar \-number
189Start
190.Ar number
191messages back from the one indicated in the
192.Pa \&.msgsrc
193file, useful for reviews of recent messages.
194.It Fl p
195Pipe long messages through
196.Xr less 1 .
197.El
198.Pp
199Within
200.Nm
201you can also go to any specific message by typing its number when
202.Nm
203requests input as to what to do.
204.Sh ENVIRONMENT
205The
206.Nm
207utility uses the
208.Ev HOME
209and
210.Ev TERM
211environment variables for the default home directory and
212terminal type.
213.Sh FILES
214.Bl -tag -width /var/msgs/* -compact
215.It Pa /var/msgs/*
216database
217.It Pa ~/.msgsrc
218number of next message to be presented
219.El
220.Sh SEE ALSO
221.Xr mail 1 ,
222.Xr less 1 ,
223.Xr aliases 5 ,
224.Xr periodic 8
225.Sh HISTORY
226The
227.Nm
228command appeared in
229.Bx 3.0 .
230