Calendar Programs
I am obsessive about keeping track of things. I used to get a free calendar each year from the local phone company. It was the perfect interface for all my appointments—a slim, spiral-bound calendar that I kept on my desktop and used to record any upcoming appointments, as well as mark the birthdays of my friends and family. Every year around the holidays I'd get a new calendar and dutifully re-transcribe the birthdays and other annual appointments into the new calendar.
A few years ago, the phone company decided to stop sending out these free calendars, but fortunately I had found a better way. By using cal and calendar programs, I can leave all my old analog date books behind.
Different versions of these utilities exist. Originally part of the BSD utilities, a GNU version called gcal with some advanced features has been released. I will focus this tutorial on the original BSD programs since they're widely available, as well as mention some other related programs at the end of the article.
You'll first want to find out if you have these programs installed on your system by typing:
which cal
If which returns a full pathname of the cal program, it is installed. If instead you are immediately returned to a shell prompt, then you will need to obtain and install this program. You can use which again to see if you have the calendar program installed as well; they are different programs and you will need them both.
If you use the Debian distribution of Linux, both programs are available in the bsdmainutils package. Otherwise, consult your distribution, or search the Linux Software Map at http://www.linuxresources.com/apps.html.
calendar is a basic reminder service. It reads a file called calendar in the current directory and prints lines which start with today's or tomorrow's dates. The calendar file is a text file that can be created and edited with any text editor.
This program is more powerful than it may seem at first. The general format for a calendar file entry is the month and day to the immediate left, followed by a tab and the reminder text. The month and day can be skipped—each line beginning with a tab carries the same month and day value as the line preceding it.
There is quite a varied syntax for the month and day. To demonstrate, let's make up a sample calendar file and look at it line by line:
10/31 Johnny's Halloween party
Friday Garbage day
Nov. 20 Dentist appointment, 9:30am
20/11 Mandatory staff meeting, 10:00am
January Happy new year!
Have you made your resolutions yet?
18 * Rent's due
Let's imagine that today is Friday, October 31, 1997. At the shell prompt, type:
calendarWith the sample calendar file in your current directory, you will see this output:
10/31 Johnny's Halloween party Friday Garbage dayThe 10/31 in the first line tells calendar to print that line if it is October 31 (or the day before), and the Friday in the second line tells it to print (you guessed it) every Friday.
As you can see, you can also use an abbreviated form of writing out the month, as in the example line starting with Nov. 20. Now, on the fourth line, the mm/dd format is reversed—in this case, calendar figures that out and will print it on the 20th day of November. It's probably not a good idea to keep records in this format. If you were to write May 10th as 10/5, calendar will assume you mean the U.S. convention of mm/dd and print that entry on October 5th.
If you have just the name of a month in the first column, calendar will print the entry on the first of that month. If you eliminate that column altogether by inserting a tab and some reminder text, calendar will print the line on the date of the preceding entry. Thus, on New Year's Day, our example calendar will output:
January Happy new year!
Have you made your resolutions yet?
Finally, substituting an asterisk for the month will print that entry on the stated date each month. In our example, a reminder to pay the rent will be displayed on the eighteenth of each month.
Since it is pre-processed by cpp, the C preprocessor, calendar recognizes include files. This allows you to keep and use special lists, such as a personal list of birthdays, without cluttering up your main calendar file. The calendar program comes with a set of such files in /usr/lib/calendar/ to get you started:
calendar.birthday: birth and death dates of many famous historical figures
calendar.computer: important dates in the history of computing
calendar.holiday: known (and not-so-well-known) holidays
calendar.music: important dates in music, especially mainstream rock-n-roll
calendar.christian: Christian holidays
calendar.history: many historical events
calendar.judaic: Jewish holidays
calendar.usholiday: standard US holidays
When you use an include statement, calendar first searches the directory it was called in, and then looks in /usr/lib/calendar/. Including this line in your file,
#include <calendar.usholiday>means calendar will first look in the current directory for such a file. If not present, it will then check /usr/lib/calendar/, and if the appropriate file is found, include it.
One of the functions of my old paper calendar was to record and keep a record of important events in my life. I was able to reproduce this function by keeping this information in files named calendar.yyyy, such as calendar.1997. Looking through the files in order gives me a chronological record of major events in my life, and if I ever wanted to see what I was doing around today's date in a certain year or years, I could add include statements for the appropriate calendar.yyyy files in my calendar file.
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Designing Electronics with Linux | May 22, 2013 |
| Dynamic DNS—an Object Lesson in Problem Solving | May 21, 2013 |
| Using Salt Stack and Vagrant for Drupal Development | May 20, 2013 |
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
- Designing Electronics with Linux
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Dynamic DNS—an Object Lesson in Problem Solving
- Using Salt Stack and Vagrant for Drupal Development
- Why Python?
- New Products
- A Topic for Discussion - Open Source Feature-Richness?
- Validate an E-Mail Address with PHP, the Right Way
- What's the tweeting protocol?
- Tech Tip: Really Simple HTTP Server with Python
Enter to Win an Adafruit Pi Cobbler Breakout Kit for Raspberry Pi

It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Pi Cobbler Breakout Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- 5-21-13, Prototyping Pi Plate Kit: Philip Kirby
- Next winner announced on 5-27-13!
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?




2 hours 20 min ago
12 hours 23 min ago
16 hours 50 min ago
20 hours 26 min ago
20 hours 58 min ago
23 hours 22 min ago
23 hours 25 min ago
23 hours 26 min ago
1 day 3 hours ago
1 day 5 hours ago