Using Google Calendar from the Linux Command Line

Computer-based calendars are very useful, and the Google Calendar is probably one of the more widely used personal calendars other than scheduling programs such as MS Outlook and Groupwise (both of which are broken). But, webby gooey applications can be rather bothersome because they tend to take up a lot of screen real estate and other resources, and on smaller screens such as a laptop can be rendered virtually useless by all that added functionality built into the web browser itself as well as the calendar page. It is quite possible that on your laptop, your Google Calendar may look something like this:


Not very useful.

~ This post is one of a series on the topic of Command Line Interface applications in Linux. Click here to see a list of all of the related posts.~

It is a little easier if you use Google Calendar's "agenda view" which simply lists, in chronological order, the upcoming appointments, so days on which you have nothing scheduled do not take up space. Like this:


But that still kind of sucks, since the vast majority of information on that screen has little to do with the information you are looking for. As long as a command line interface is available, which it is, wouldn't it be nice to have a quick and dirty command that you could type in to retrieve your calendar, perhaps manipulate it, and even get a simple text-based agenda view that one can actually see?

There is, and it's called gcalcli. When I type "gcalcli" into a command line with the argument "agenda", I get this:


With relatively little configuration, gcalcli knows where to go and get my calendar information. The program has lots of options, most of which are used to select among the various calendars you have access to or to configure the output. When I typed in:

gcalcli list

the program outputs a list of four calendars that I have access to. I knew about the first two of them already. The third is a calendar called "US Holidays" which I imagine comes along with Google Calendar. The fourth is that of an organization I belong to, though I had forgotten about the calendar.

One option tells the "agenda" command to include all the details within the calendar and not just the date/time and name of event. The calendars can be searched (but for whole words only). Another command outputs a week's calendar in a nice formatted arrangement:


And, yet another outputs an entire month. Unfortunately, when I tried that I got an error and some gobbly-code.

It is possible to add single appointments using the command "quick":


There is also a way to execute a command if an event is to occur within a certain amount of time. This might be run on start up of a particular terminal or integrated with a chron job, to develop your own personal way of annoying yourself into getting your stuff done.

There are lots of other options. You can read more about it here, and if you are using Debian/Ubuntu, you can install the software in synaptic (search for gcalcli) or by simply typing the magic words:

sudo apt-get install gcalcli

This application firmly sits in the Class II cli App category, which I've discussed before. This is where you want a GUI version and a cli version of the same app, in this case, accessing the same database. Different circumstances demand different approaches. Learning two or three commands with gcalcli will augment your Google Calendar experience and make you look really cool at the coffee shop. But there will still be times when the web-based GUI interface makes the most sense.

Furthermore, and I'm sure you already know this, you can easily define and save an alias for "gcalcli agenda" (or any other combination of frequently used commands and options) so you would type only, say "agenda" or "appointments" or whatever to get the output you need on a regular basis.

Here's another little trick in case you want to totally geek out. If you are using alpine for your email (I'll discuss this great app later) you can type in ctrl-_ and call emacs as your secondary editor. From within emacs, select some irrelevant text (that step may not be necessary) and type ctrl-u to cause the output of the next command to replace that text. Then type shift-alt-| (the vertical bar thingie), which allows you to enter a shell command. Then, type in

gcalcli --nc agenda

The --nc strips the output of its color coding control codes, which are messy when they are not spewed onto a terminal. The selected text will be replaced with your agenda in nice, text form. Save, exit, and you're back in alpine with your email to your significant other who just asked you "Are you available Wednesday night to go pick up the new car seat?" or whatever.

Obviously once you've done that a few times and perhaps refined the exact procedure, you'd make these commands into a macro so little more than a stern look and the flip of a single finger will insert your current agenda into whatever email you are currently writing. How cool is that?

More like this

This is the first in a series about using the "command line" in Linux. It is also about knowing when to use a gui instead. But before going into any of that we need to understand what is meant by a "command line" application. You'll find that as we explore that idea, a lot of things that are not…
This is one of four related posts: Should You Install Ubuntu Linux?Installing Ubuntu 16.04 LTSHow to use Ubuntu UnityThings To Do After Installing Ubuntu 16.04 LTS Some Linux/Ubuntu related books:Ubuntu Unleashed 2016 Edition: Covering 15.10 and 16.04 (11th Edition)Ubuntu 16.04 LTS Desktop:…
MOST CURRENT INFORMATION WILL BE FOUND HERE: Things To Do After Installing Ubuntu 16.04 LTS NEW: Very first look at Ubuntu Linux 15.04 Vivid Vervet Beta Mate Flavor See: Books on Linux and Ubuntu NOTE: This may not be the blog post you are looking for. If you have installed Ubuntu 14.10 and want…
The command line is a great place to get weather information. Here, I discuss one cli-app for current conditions and forecasts, in the larger context of why you would ever want to use the command line anyway. There are several ways to use your computer to check the weather. One is to use the…

M$ hater Greg Laden. I certainly understand where you're coming from, but I must say, Windows 7 is terribly awesome.

Yea, maybe. But I heard that about Windows 2000 and I heard that about XP and yes, I even heard that about Vista.

Even if MS managed to make an operating system that was not fundamentally horrid, it would still be fundamentally evil because the proprietary system spawns bad practices and regressive development.

My wife is running Windows 7 on her laptop, and her laptop is technically superior to mine. We sit there next to each other on the couch doing stuff. My stuff gets done. Then, I finish and hand her my Linux computer, then she gets her stuff done.

As an avid linux user, I have to say that both on my laptop and desktop google calendar is clear and easy to use. I don't really know what's going on on your computer - perhaps you could adjust your screen resolution or fonts?

Frankly, I think the gcali command is a solution in search of a problem.

Best Linux distribution? My goal is to re-acquaint myself with unix. And learn more about running linux. I will not be using it as a primary OS - at least not that image.

I have a new MacBook Pro with 10.6. I have a Win 7 64bit VM and want a linux VM. I loaded an image on Ubuntu a while back but could not imstall it on an old PC as something was wrong somewhere. never bothered to look into it.

What should I start with. I can always blow away the VM and start again if needed.

I am using Parallel for VMs.


Richard, having installed it and used it a few times today, I have to say I disagree strongly, at least for me. Since I already do a range of things on the command line, having the ability to pop up my calendar for the next few days is very cool.

Richard, I tend to not agree. Command line access to webby online services is available for a lot of services, and people make good use of it. The fact that I can easily write a macro that pops my schedule into an email is a real solution to a real need, for example. I'm not surprised it does not meet YOUR need (simply because it won't meet most people's need). But that's the thing about Linux. There is no marketing department insuring that development efforts are shut down for products that will have too small a base.

Richard -

While I can see why it might be useful for some folks, I am rather fond of google calender just the way it is. I get a text either an hour or two (depends on what the "event" is) before I have to do something and get both an email reminder and a pop-up if I am on the computer. The email is a daily, rather than a "by the event" reminder and I don't get one if I don't have anything scheduled. The only time I actually use the interface is to add things to my schedule.

I also use it to remind me that assignments are due - my daily email reminds me two days in advance.

Being a rather disorganized person in general and incapable of keeping a paper planner, this rocks. Not being big on command line computing, I will stick to the way it is now. But having noticed that Greg seems rather big on command lines and not so much on my sort of point and click lifestyle, this makes a lot of sense. And it is a wonderful thing about Linux - people like Greg can have all the fun the want the way they want, while relatively ignorant assholes like me can use it without much opening of the terminal (and then only to cut and paste something someone else suggested or I found using google).

While I honestly don't understand why people would want to use command lines for so many things, I also know that some of my behaviors are similarly incomprehensible to others. And I am glad that so many people roll like that, because they are the people who usually know how to fix shit that doesn't work for me. They are also the people who made it possible for me (and others like me) to use Linux.

Re: getting your agenda into Emacs -- you can insert the output of a command without selecting any text using "C-u M-! command". That inserts the output of the command into the buffer at point.

I hate a lot of what microshaft does simply because it sets itself up to be an inscrutable monopoly on the things that I enjoy doing, namely "Playing video games". (If you want to see what a production linux computer can do in terms of gaming, look no further than the PS3, and that's actually got significantly less power than one would expect.) I get much better hardware optimization with much lower overhead when I run linux. I use it when I virtualize windows servers for my classes. What I can't understand is why these companies see linux users as thrifty and unreliable sources of income. Windows 7 is bloated and takes a significant amount of power to run. I run a Core-i7 laptop and it steals a good chunk of CPU time off the top of anything I run. Thank various gods that I don't believe in that there are some very gifted programmers in the linux community.

Also: the command line is a hell of a lot faster and more efficient. I use CLI programs 2-3 times more than GUI programs because both of my hands get to stay on the keyboard and I don't lose workflow.

George, as you have an old computer, you should download and install the alternative Ubuntu ISO. That has always worked for me, even in upgrading Ubuntu, for which the free CD they send me doesn't work. This is at their website.

Something that helps me is a program called tilda. Tilda is a popup terminal that you can call up with a single keystroke, or a combination. I don't need to keep a terminal open all the time, and have to find it with the mouse, I just press a key and have an instant terminal ready. It's very configurable. I can check my calendar quicker with this than I can with a mouse, and I also have the weather-utils program installed, with aliases defined, so I can get the current and forecast weather for several locations much quicker than I can through Firefox. I'm an EMS pilot, and I often need to get a weather report quickly before I accept a flight, and this is quick and easy. The command line isn't for everyone, nor is it for everything, but it's the best tool for me, for some things. I normally use Evolution for my calendar, and it shows my Google calendar, those of my family members, and also my private calendar, which has things I don't necessarily want anyone else to see. But it's not always the most convenient, so gcalcli is another convenient tool. Sometimes you need not just a hammer, but a hammer of a particular design, size, and weight.

RSG, I use tilda pretty much the same way. I have it mapped to F1.

I used synaptic to install on Ubuntu 9.10 and gcalcli commands failed with a "Traceback" error. Editing a single line of /usr/bin/gcalcli fixed it:

I think some people were thrown off by the intro showing Google Calendar in too small of a browser window. That isn't a problem many of us are having. There are lots of other reasons for gcalcli. I'm loving it. I do use alpine and emacs, so thanks for that tip. Nice article!

By Mike Miller (not verified) on 10 Oct 2010 #permalink

I'm with you on this Class II gui cli synergy. If you continue to find little gems and blog about them like this google calendar tool then we can get back to work instead of pointing and clicking our lives away. Now we need a Class II project manager tool.

I'm using a Meeting rule, in which I've selected PC Sync (since I sync with ouooltk on my pc), ticked Only for Busy' items' and put * for matching any event. The idea of course is to activate the rule whenever I'm in any Busy' meeting (e.g. not for a free event like a birthday etc). The problem is, it seems to activate for Free calendar events as well. Is this just a limitation of the app or am I doing something wrong?

Hi there,

Does this work with your predefined e-mail in ubuntu? - sorry starting in linux machines...

I get this error, obviously I have not set any e-mail...
xx@zzz:~$ gcalcli agenda
Traceback (most recent call last):
File "/usr/bin/gcalcli", line 392, in
class gcalcli:
File "/usr/bin/gcalcli", line 410, in gcalcli
dateParser = DateTimeParser()
File "/usr/bin/gcalcli", line 335, in __init__
self.pdtCalendar = parsedatetime.Calendar();
File "/usr/lib/python2.7/dist-packages/parsedatetime/", line 216, in __init__
self.ptc = Constants()
File "/usr/lib/python2.7/dist-packages/parsedatetime/", line 1733, in __init__
self.locale = pdtLocales['icu'](self.localeID)
File "/usr/lib/python2.7/dist-packages/parsedatetime/", line 151, in __init__ = pyicu.Locale(localeID)
icu.InvalidArgsError: (, '__init__', (None,))

Any help?