oreilly.comSafari Books Online.Conferences.


Living Linux

Managing Appointments


The subject of this week's column is how to manage your appointments using a simple reminder service, the calendar tool.

It reportedly first appeared in Version 7 of AT&T Unix, and was rewritten early on for the BSD family of Unix. The BSD derivate is available for Debian as part of the bsdmainutils package, but this tool isn't yet standard on all Linux distributions (including Red Hat). If your distribution doesn't have it, you can obtain the source package from Debian.

What it does

When calendar executes, it reads a "calendar file" in the current directory which contains a list of appointments and reminders, and it outputs those entries in the file for today or tomorrow's date. (On a Friday, it outputs entries for that weekend and for the following Monday.)

For example, if today is Friday, June 16, and you run calendar in the same directory as your calendar file, typical output might look like this:

$ calendar RET
6/16	Finish draft of presentation!
	Rob's party
Fri	Lunch with Kim and Jo
Mon	Presentation to staff, 1pm

Format of the calendar input file

To begin using calendar, you need to make a "calendar file" where you can enter your appointments. It's just a plain text file, and can be called either calendar or .calendar (the latter makes it a "hidden" file).

Write each appointment or calendar entry on a line by itself (blank lines in the file are ignored). Entries are formatted like this:

[date][tab or other whitespace][text of reminder itself]

Just about every common date style is recognized. For example, the following are all valid dates for the Fourth of July:

July 4
4 July
Jul. 4
Jul 4

Entries aren't constrained to a single day, either; you can have entries for a day of the week or for a certain month -- "Mon" or "Monday" for every Monday; "Jun" or "June" for the first day of every June. You can use an asterisk as a wildcard: "*/13" reminds you of something on the thirteenth of every month. When the date is omitted on a line, the date on the preceding line is used.

For example, suppose you have a file called calendar in your home directory which contains the following:

6/16	Finish draft of presentation!
	Rob's party	
Fri	Lunch with Kim and Jo
Mon	Presentation to staff, 1pm

If the current date is 16 June, a Friday, and you run calendar in your home directory, you'll get the output shown in the first example in this column.

Note that the entry about the party does not have a date on it -- the date of the previous entry is assumed.

Pages: 1, 2

Next Pagearrow

Linux Online Certification

Linux/Unix System Administration Certificate Series
Linux/Unix System Administration Certificate Series — This course series targets both beginning and intermediate Linux/Unix users who want to acquire advanced system administration skills, and to back those skills up with a Certificate from the University of Illinois Office of Continuing Education.

Enroll today!

Linux Resources
  • Linux Online
  • The Linux FAQ
  • Linux Kernel Archives
  • Kernel Traffic

  • Sponsored by: