Calendaring from the command line
When
When is one of the best-organized, command-line calendaring tools. The first time you run When, a wizard helps you create the ~/.when
directory and its two files: calendar
and preferences
(Figure 4). The wizard also sets the default text editor that you will use to edit the calendar files – either the default emacs or an editor of your choice. You can change both the directory and the editor later by editing the preferences file.
To add an entry to When, type the command jump e
(note that the "e" is a command, not an option, so it does not have a hyphen). The command opens the calendar file in the editor specified in the preferences file.
From the editor, you can add appointments one per line, in the following format, with a single space between each part:
[YYYY] [MONTH] [DAY] , [Entry].
For example:
2014 12 18 , Depart for Portland for Christmas holidays at 8:30am.
The month can be indicated by a number or any abbreviation that makes it unique, which means at least the first three letters.
If your calendar has no entries, running the when
command without options prints the current date and time. However, the calendar will also print any appointments within the next two weeks, adding the day of the week to the appointment (Figure 5). Alternatively, you can specify to display appointments for the coming week (when w
), month (when m
), or year (when y
) or print a calendar of the next three months, starting with the current month (when c
).
For annual events, you can replace the year with an asterisk (*). Similarly, enter a weekly event by replacing the day with w=DAY
, using the first three letters of the name of the day, such as w=mon
. Additionally, if you start the entry with a time using a 24-hour clock, then when
will display multiple events on the same day in chronological order.
Besides these basic commands, When also includes numerous options, which can be either entered at the command line or added to the preferences file. For example, the options --future=DAYS
and --past=DAYS
sets the days displayed, and --ampm
specifies using a 12-hour clock instead of the default 24, with a
or p
following the number. Other options set the number of rows and columns in which to display results, and the font weight and color for the display. The man page has a complete list of available options and preferences, although you can use When perfectly well without most of them.
Pipes and Starting Commands
When creating event entries for Calendar, Remind, and When, you can keep your calendar files readable by maintaining chronological order. However, if you forget, you can get a chronological list of events by adding the sort
pipe at the end of any of these commands. The pipe will automatically print out all the events it recognizes in chronological order.
Similarly, although you should refer to your calendar regularly, you can avoid relying on a busy or preoccupied mind by setting your calendar application to run when you first log in. If you are using a major desktop, you might be able to find a configuration feature to list startup programs, such as KDE's Autostart. Another choice, if you login at the same time every day, is to piggyback your calendar on crontab. Still another alternative is to write a script, although its structure will depend on the init daemon on your system.
One concern is that none of these applications are intended for sharing calendars. If you need to share calendars, you might try gcalcli [7], which is designed to log in to Google Calendar. Although gcalcli is a command-line program, once you learn a few basic commands, it may be quicker and more responsive than using Google Calendar's graphical interface.
For strictly personal use, however, Calendar, Remind, and When are all applications that combine the philosophy of Unix (short, simple, clear, modular, and extensible code that is easily maintained and repurposed) [8] with an efficiency that the desktop sometimes loses track of. My suggestion is to start with When, the simplest of the three, then explore Calendar and Remind after you have enough hands-on experience to know what extra features you want.
Infos
- Cron: https://en.wikipedia.org/wiki/Cron
- Anacron: https://en.wikipedia.org/wiki/Anacron
- Cal: https://en.wikipedia.org/wiki/Cal_%28Unix%29
- Calendar: http://www.computerhope.com/unix/ucalande.htm
- Remind: http://www.linuxjournal.com/article/3529
- When: http://www.lightandmatter.com/when/when.html
- gcalcli: https://github.com/insanum/gcalcli
- Unix philosophy: http://en.wikipedia.org/wiki/Unix_philosophy
« Previous 1 2
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
![Learn More](https://www.linux-magazine.com/var/linux_magazin/storage/images/media/linux-magazine-eng-us/images/misc/learn-more/834592-1-eng-US/Learn-More_medium.png)
News
-
NVIDIA Released Driver for Upcoming NVIDIA 560 GPU for Linux
Not only has NVIDIA released the driver for its upcoming CPU series, it's the first release that defaults to using open-source GPU kernel modules.
-
OpenMandriva Lx 24.07 Released
If you’re into rolling release Linux distributions, OpenMandriva ROME has a new snapshot with a new kernel.
-
Kernel 6.10 Available for General Usage
Linus Torvalds has released the 6.10 kernel and it includes significant performance increases for Intel Core hybrid systems and more.
-
TUXEDO Computers Releases InfinityBook Pro 14 Gen9 Laptop
Sporting either AMD or Intel CPUs, the TUXEDO InfinityBook Pro 14 is an extremely compact, lightweight, sturdy powerhouse.
-
Google Extends Support for Linux Kernels Used for Android
Because the LTS Linux kernel releases are so important to Android, Google has decided to extend the support period beyond that offered by the kernel development team.
-
Linux Mint 22 Stable Delayed
If you're anxious about getting your hands on the stable release of Linux Mint 22, it looks as if you're going to have to wait a bit longer.
-
Nitrux 3.5.1 Available for Install
The latest version of the immutable, systemd-free distribution includes an updated kernel and NVIDIA driver.
-
Debian 12.6 Released with Plenty of Bug Fixes and Updates
The sixth update to Debian "Bookworm" is all about security mitigations and making adjustments for some "serious problems."
-
Canonical Offers 12-Year LTS for Open Source Docker Images
Canonical is expanding its LTS offering to reach beyond the DEB packages with a new distro-less Docker image.
-
Plasma Desktop 6.1 Released with Several Enhancements
If you're a fan of Plasma Desktop, you should be excited about this new point release.