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