Previous Table of Contents Next

Module 93
news (SV)


The external news command informs the user of any late breaking news. The news items are usually related to the system. The editor is most likely to be the system administrator. Depending on your system's setup and operations you may be able to post news for others to view.


Following is the general format of the news command.

     news [ -ans ] [ items ]


The following list describes the options and their arguments that may be used to control how news functions.

-a All news items are displayed in their entirety regardless of modification times. The .news_time file is not modified.
-n All filenames (names of the current items) are displayed regardless of the modification time. The .news_time file is not modified.
-s Displays the total number of news items without displaying item names or contents. The .news_time file is not modified. This option is often used in the user's .profile file or the system's /etc/profile file to inform you of how many news items exist.


The following describes the argument that may be passed to the news command.

items A list of filenames stored in /usr/news that contain news type information.


Each news item is stored in a separate file. All news files are stored in the /usr/news directory. When you execute news, it checks a file named .news_time in your $HOME directory for the last time you viewed the news items. Based on the modification date of this file, news will print all items that have been posted since the specified date and time.

If you press Delete while news is displaying a news item, news stops displaying the current item and starts displaying the next item. If you press two Deletes within a one-second time frame, news terminates.


The following list of files are used by the news command.

/vars/news/* Items stored for release and viewing
/$HOME/.news_time The modification time is used to know when the user last read news items.
/etc/profile Often contains the "news -s" command, which shows you how many news items are currently posted for reading.
standard out The output is written to standard output.


The news command is used to keep users up to date on system activities, corporate events, extremely important sports events (World Series, Superbowl, etc.), and other pertinent news items. News is often used to broadcast warnings or software release notes. The type of news and who can post it is decided by the system administrator or corporate policy


In this activity you use the news command to see if any news items have been posted on your system. If so you use news to read them. Begin at the shell prompt.

1.  Type news -s and press Return. The number of news items posted on your system are returned. If a number is not returned, then no items are currently posted. If your system has news items posted, your screen should resemble the following display.
     cj> news -s
     news: 2

The above display shows 2 news items are available for viewing. If nothing is displayed, no news items are available for viewing. You may want to create a news item just for testing. Simply type vi /usr/news/test and press Return. Type in a brief message, save the file, and exit vi. Retype the news -s command as previously discussed.
2.  Type news and press Return to display the two news items.
3.  Turn to Module 156 to continue the learning sequence.

Previous Table of Contents Next