LinuxCommandLibrary

khal

Manage and view calendar events

TLDR

Start Khal in interactive mode

$ khal interactive
copy

Print all events scheduled in personal calendar for the next seven days
$ khal list -a [personal] [today] [7d]
copy

Print all events scheduled not in personal calendar for tomorrow at 10:00
$ khal at -d [personal] [tomorrow] [10:00]
copy

Print a calendar with a list of events for the next three months
$ khal calendar
copy

Add new event to personal calendar
$ khal new -a [personal] [2020-09-08] [18:00] [18:30] "[Dentist appointment]"
copy

SYNOPSIS

khal [options] {calendar,list,new,edit,delete,search,export,import,printcal} [args]

PARAMETERS

-h, --help
    Show help message and exit

-a ADDRESSBOOK, --addressbook ADDRESSBOOK
    Only show events from specified calendar/addressbook

-b CONFIG, --configfile CONFIG
    Path to configuration file (default: ~/.config/khal/khal.conf)

-d DAYFORMAT, --dayformat DAYFORMAT
    Format for day headers (strftime)

-D, --debug
    Enable debug logging

-l LOCALE, --locale LOCALE
    Locale for dates and week starts

-f {ics,vcf}, --format {ics,vcf}
    Input/output format (default: ics)

-V, --version
    Show version and exit

--color COLOR
    Color scheme (never/auto/always)

--firstweekday FIRSTWEEKDAY
    First day of week (0=Mon,6=Sun)

--datetimeformat DATETIMEFORMAT
    Strftime for datetime display

--print-format {calendar,agenda,detailed}
    Format for printcal command

--term-width TERM_WIDTH
    Terminal width override

DESCRIPTION

Khal is a standards-compliant command-line calendar application designed for terminal users. It reads and writes events to vdir directories using iCalendar (ICS) format and supports synchronization with CalDAV servers via vdirsyncer.

Key features include displaying calendars, listing events in agenda or detailed views, creating/editing/deleting events and recurring events, searching by text or time, importing/exporting ICS files, and printing calendars. It handles multiple calendars/addressbooks, todos, and customizable output formats for dates, times, and colors.

Khal emphasizes speed, privacy (local-first), and Unix philosophy, integrating well with tools like ikhal (curses TUI frontend), khard (contacts), and shell scripts. Configuration is via INI files specifying calendars, locales, and formats. No GUI dependencies; pure Python with dateutil and icalendar libraries. Ideal for power users avoiding bloated clients like Thunderbird.

CAVEATS

Requires valid configuration file with [calendars] section pointing to vdir paths. Recurring events may need manual handling. No built-in CalDAV sync (use vdirsyncer). Python 3.8+ needed.

CONFIGURATION

Edit ~/.config/khal/khal.conf: define [calendars] paths, [locale] settings, [view] formats. Example:
[calendars]
personal = ~/calendars/personal

SUBCOMMANDS

calendar: display grid
list: agenda view
new YYYY-MM-DD [HH:MM]: create event
edit/delete UUID: modify/remove
search TEXT: find events

INSTALLATION

Via pip: pip install khal
Or distro packages: apt install khal (Debian), dnf install khal (Fedora)

HISTORY

Started in 2013 by Georg Faerber to create a free calendaring stack. Reached v0.1 in 2014; current stable ~0.11 (2023). Maintained on GitHub with focus on standards compliance and CLI usability.

SEE ALSO

vdirsyncer(1), ikhal(1), khard(1), cal(1)

Copied to clipboard