xref: /freebsd/usr.bin/msgs/msgs.1 (revision 1843dfb05ed80149f5a412180af882e3cb8f451b)
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.\"	@(#)msgs.1	8.2 (Berkeley) 4/28/95
29.\"
30.Dd August 8, 2018
31.Dt MSGS 1
32.Os
33.Sh NAME
34.Nm msgs
35.Nd system messages and junk mail program
36.Sh SYNOPSIS
37.Nm
38.Op Fl fhlpq
39.Op Ar number
40.Op Ar \-number
41.Nm
42.Op Fl s
43.Nm
44.Op Fl c
45.Op \-days
46.Sh DESCRIPTION
47The
48.Nm
49utility is used to read system messages.
50These messages are
51sent by mailing to the login `msgs' and should be short
52pieces of information which are suitable to be read once by most users
53of the system.
54.Pp
55The
56.Nm
57utility is normally invoked each time you login, by placing it in the file
58.Pa .login
59(or
60.Pa .profile
61if you use
62.Xr sh 1 ) .
63It will then prompt you with the source and subject of each new message.
64If there is no subject line, the first few non-blank lines of the
65message will be displayed.
66If there is more to the message, you will be told how
67long it is and asked whether you wish to see the rest of the message.
68The possible responses are:
69.Bl -tag -width Fl
70.It Fl y
71Type the rest of the message.
72.It Ic RETURN
73Synonym for y.
74.It Fl n
75Skip this message
76and go on to the next message.
77.It Fl
78Redisplay the last message.
79.It Fl q
80Drop out of
81.Nm ;
82the next time
83.Nm
84will pick up where it last left off.
85.It Fl s
86Append the current message to the file ``Messages'' in the current directory;
87`s\-' will save the previously displayed message.
88A `s' or `s\-' may
89be followed by a space and a file name to receive the message replacing
90the default ``Messages''.
91.It Fl m
92A copy of the specified message is placed in a temporary
93mailbox and
94.Xr mail 1
95is invoked on that mailbox.
96Both `m' and `s' accept a numeric argument in place of the `\-'.
97.El
98.Pp
99The
100.Nm
101utility keeps track of the next message you will see by a number in the file
102.Pa \&.msgsrc
103in your home directory.
104In the directory
105.Pa /var/msgs
106it keeps a set of files whose names are the (sequential) numbers
107of the messages they represent.
108The file
109.Pa /var/msgs/bounds
110shows the low and high number of the messages in the directory
111so that
112.Nm
113can quickly determine if there are no messages for you.
114If the contents of
115.Pa bounds
116is incorrect it can be fixed by removing it;
117.Nm
118will make a new
119.Pa bounds
120file the next time it is run with the
121.Fl s
122option.
123If
124.Nm
125is run with any option other than
126.Fl s ,
127an error will be displayed if
128.Pa /var/msgs/bounds
129does not exist.
130.Pp
131The
132.Fl s
133option is used for setting up the posting of messages.
134The line
135.Pp
136.Dl msgs: \&"\&| /usr/bin/msgs \-s\&"
137.Pp
138should be included in
139.Pa /etc/mail/aliases
140(see
141.Xr newaliases 1 )
142to enable posting of messages.
143.Pp
144The
145.Fl c
146option is used for performing cleanup on
147.Pa /var/msgs .
148A shell script entry to run
149.Nm
150with the
151.Fl c
152option should be placed in
153.Pa /etc/periodic/daily
154(see
155.Xr periodic 8 )
156to run every night.
157This will remove all messages over 21 days old.
158A different expiration may be specified on the command line to override
159the default.
160You must be the superuser to use this option.
161.Pp
162Options when reading messages include:
163.Bl -tag -width Fl
164.It Fl f
165Do not say ``No new messages.''.
166This is useful in a
167.Pa .login
168file since this is often the case here.
169.It Fl q
170Queries whether there are messages, printing
171``There are new messages.'' if there are.
172The command ``msgs \-q'' is often used in login scripts.
173.It Fl h
174Print the first part of messages only.
175.It Fl l
176Cause only locally originated messages to be reported.
177.It Ar num
178A message number can be given
179on the command line, causing
180.Nm
181to start at the specified message rather than at the next message
182indicated by your
183.Pa \&.msgsrc
184file.
185Thus
186.Pp
187.Dl msgs \-h 1
188.Pp
189prints the first part of all messages.
190.It Ar \-number
191Start
192.Ar number
193messages back from the one indicated in the
194.Pa \&.msgsrc
195file, useful for reviews of recent messages.
196.It Fl p
197Pipe long messages through
198.Xr less 1 .
199.El
200.Pp
201Within
202.Nm
203you can also go to any specific message by typing its number when
204.Nm
205requests input as to what to do.
206.Sh ENVIRONMENT
207The
208.Nm
209utility uses the
210.Ev HOME
211and
212.Ev TERM
213environment variables for the default home directory and
214terminal type.
215.Sh FILES
216.Bl -tag -width /var/msgs/* -compact
217.It Pa /var/msgs/*
218database
219.It Pa ~/.msgsrc
220number of next message to be presented
221.El
222.Sh SEE ALSO
223.Xr mail 1 ,
224.Xr less 1 ,
225.Xr aliases 5 ,
226.Xr periodic 8
227.Sh HISTORY
228The
229.Nm
230command appeared in
231.Bx 3.0 .
232