Reads system messages.
msgs [ -f ] [ -h ] [ -l ] [ -p ] [ -q ] [ [ - ] Number ]
msgs [ -s ]
msgs -c [ -Days ]
The msgs command reads system messages that are read once by most users of the system. Similar to bulletins, these messages are short pieces of information sent to the user name msgs using the mail command.
If you put the msgs command in either the $HOME/.login or $HOME/.profile file, you are prompted with the source and subject of each new message each time you log in to the system. If there is no subject line, the first few nonblank lines of the message are displayed. If the message is longer than a few lines, you are told how long the message is and asked if you wish to see the rest of the message. The possible responses are:
|Number||Starts the msgs command at the message specified by the Number parameter, rather than at the next message indicated by your $HOME/.msgsrc file.|
|-||Displays the previous message.|
|Enter||Displays the rest of the message.|
|m or m-||Places a copy of the specified message in a temporary mailbox and starts the mail command on that mailbox. (Accepts a numeric argument in place of the -.)|
|n or N||Skips the current message and moves to the next message.|
|q or Q||Ends the msgs program.|
|s or s- File||Appends the current message to the default Messages file in the current directory. The s- option saves the previously displayed message. An s or s- option followed by the File variable specifies the file to receive the message.|
|x or X||Exits without flushing the message.|
|y or Y||Displays the rest of the message.|
The msgs command keeps track of the next message with a number in the $HOME/.msgsrc file. The /var/msgs directory keeps a set of files whose names are the sequential numbers of the messages they represent. The /var/msgs/bounds file shows the low and high number of the messages in the directory so the msgs command can quickly determine if there are no messages for you. If the contents of the /var/msgs/bounds file is incorrect, remove it. The msgs command will make a new bounds file the next time it is run.
Note: Messages can contain multibyte characters.
|-Number||Displays the message that is the difference between the number of messages in the $HOME/.msgsrc file and the number specified by the -Number parameter. For example, if you want to display the second message out of five that reside in the $HOME/.msgsrc file, enter a -3 as the -Number parameter.|
|-c||Performs cleanup on the /var/msgs file. An entry with the -c flag should be placed in the /var/spool/cron/crontabs directory to run every night. The -c flag removes all messages over 21 days old. A different expiration may be specified on the command line to override the default.|
|-f||Prevents display of the message: No new messages.|
|-h||Causes the msgs command to display only the first part of the messages.|
|-l||Causes only locally originated messages to be reported. The locally originated messages are created by local users instead of NIS (YP) clients.|
|-p||Pipes long messages through the more command.|
|-q||Queries whether messages exist. Any new messages are displayed. The msgs -q command is often used in login scripts.|
|-s||Causes a message to be posted.|
msgs -h 1The first part of the message is displayed. The posting of messages is now enabled.
msgs 4In this example, message 4 is displayed.
msgs -qIf you have new messages, the following statement is displayed:
There are new messages.
msgs: | /usr/bin/msgs -s
|/etc/aliases||Enables posting of messages.|
|/var/msgs||Contains directory of message files.|
|/var/msgs/bounds||Shows the low and high number of messages in the directory.|
|$HOME/.msgsrc||Contains number of next message to be presented.|
|/usr/bin/msgs||Contains the msgs command.|
Mail Overview in AIX Version 4.3 System User's Guide: Communications and Networks.
Mail Overview for System Management in AIX Version 4.3 System Management Guide: Communications and Networks.
The crontab command, mail command, more command.