Previous Table of Contents Next

Module 11


The external calendar command provides a daily reminder service. It searches for strings anywhere in the "calendar" file that match today's or tomorrow's date.


Following is the general format of the calendar command.

     calendar [ - ]


The following argument may be passed to the calendar command.

- If present, calendar performs its functions for every user who has a "calendar" file in his login(usually $HOME) directory. The output from calendar is sent to the user via mail.


The following list illustrates the most common forms of date that calendar searches for in the file:

Format Example

Mon. DD Jan. 21
Month DD January 21
MM/DD 01/21
The calendar command does NOT recognize the following formats:
DD Month 21 January
DD/MM 21/1

The concept of tomorrow extends across weekends. For example, if you run calendar on a Friday, it will display any lines containing Monday's date.

If the environment variable DATEMSK is set, calendar will use the format strings in the specified file based on the values of the environment varialbes LANG and LC_TIME. Refer to the module on date for a description of available format strings.


Your calendar file must be readable public information for your reminder service to work properly. That is to say the permissions on your calendar file must at least be r-r-r-.

The extended idea of tomorrow does not account for holidays.


Refer to the cal, date and mail commands described in modules 10, 30, and 86 respectively.


The calendar command writes to the standard output. The following list describes the files that calendar uses to perform its tasks.

/usr/lib/calprog Used to figure out the correct dates for today and tomorrow.
/etc/passwd System passwd file used to find each users login (HOME) directory.


The calendar program is used to provide a daily reminder service. If you need to remember certain appointments or assignments on a daily basis, the calendar command is the answer. It can be run by the system for you or you can execute it for yourself as needed.


In this activity you use the calendar command to display lines from the calendar file. The first step is to create a calendar file. Begin at the shell prompt.

1.  Type cat > calendar and press Return. You may use an editor if you wish.
2.  Type the following lines of text and press Ctrl-D. This creates a calendar file.

Replace the following Jan. 17 and 21 dates with tomorrow's date and some other date.

     cj> cat > calendar
     Jan. 17 - Take the car at lunch for an oil change.
     Jan. 21 - Begin restructuring of all UNIX workstations.
3.  Now that you have a calendar file to use, type calendar and press Return. Your screen should resemble the following display.
     cj> calendar
     Jan. 17 - Take the car at lunch for an oil change.
4.  Turn to Module 30 to continue the learning sequence.

Previous Table of Contents Next