插件窝 干货文章 linux calendar如何设置提醒

linux calendar如何设置提醒

提醒 日历 bash 工具 652    来源:    2025-05-14

在Linux系统中设置日历提醒可以通过多种工具实现,以下是几种常见方法的详细说明:


一、使用 cal 命令(基础查看)

cal 是Linux自带的日历工具,但仅支持查看,不支持提醒功能。若只需快速查看当月日历:

cal

二、图形化工具(推荐新手)

  1. GNOME Calendar(Ubuntu等GNOME桌面默认集成)

    • 打开应用后点击 + 添加事件,设置时间和提醒选项。
    • 支持邮件/弹窗提醒,需确保后台服务运行。
  2. Thunderbird + Lightning插件

    • 安装Thunderbird后,通过附加组件安装Lightning日历插件。
    • 添加事件时可设置自定义提醒(声音/弹窗)。

三、命令行工具(适合高级用户)

1. khal + vdirsyncer

  • 安装bash sudo apt install khal vdirsyncer # Debian/Ubuntu
  • 配置
    • 同步远程日历(如Google Calendar)或本地创建: bash vdirsyncer discover vdirsyncer sync
    • 添加事件并设置提醒: bash khal new 2024-07-20 15:00 "Meeting" -a work -r 10m -r 10m 表示提前10分钟提醒。

2. remind 工具

  • 安装bash sudo apt install remind
  • 创建提醒文件(如 ~/.reminders): text REM 20 Jul 2024 AT 15:00 MSG "Team meeting @ Conference Room"
  • 测试提醒bash remind -n ~/.reminders
  • 自动化:将 remind -z ~/.reminders 加入crontab或桌面环境自启动。

四、系统级定时任务(cron + notify-send

  1. 编辑crontab: bash crontab -e
  2. 添加定时提醒(示例:每天9点弹窗): bash 0 9 * * * DISPLAY=:0 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus notify-send "Daily Standup!"
    • 需替换DISPLAYDBUS变量确保图形弹窗正常。

五、第三方工具推荐

  • Calcurse:终端日历+待办清单 bash sudo apt install calcurse calcurse -i # 交互式添加事件
  • Taskwarrior:高级任务管理,支持提醒插件(如tasknotify)。

六、跨平台同步方案

  • Syncthing:同步日历文件(如.ics)到多设备。
  • Nextcloud:自建日历服务器,支持WebDAV同步。

常见问题

  • 弹窗不显示:确保libnotify已安装,且桌面通知未被禁用。
  • 时区问题:使用timedatectl set-timezone Your/Timezone调整。

根据需求选择合适方案:图形工具适合普通用户,命令行方案适合自动化或服务器环境。