Hacker News new | past | comments | ask | show | jobs | submit login

Maybe not what the article is exactly talking about, but `cal` will give you a calendar in terminal. `cal -3` will give you each surrounding month, and `cal 2022` will give you the full year



I have a shell function I use all the time to keep track of both calendar and timezones where our teams are located

  now() {
    cal -3
    echo
    echo -n "Local:       "
    date --rfc-3339=s
    echo -n "UTC:         "
    date -u --rfc-3339=s
    echo -n "New York     "
    TZ='America/New_York' date --rfc-3339=s
    echo -n "London:      "
    TZ='Europe/London' date --rfc-3339=s
    echo -n "New Zealand: "
    TZ='Pacific/Auckland' date --rfc-3339=s
  }


Often I use cal to find the previous or next month. I never understood why two parameters it assumes `cal mm yyyy` but when one parameter is provided assumes `cal yyyy` instead of `cal mm`.

ie, I just want to see April of this year: but `cal 4` returns Jan-Dec 0004 CE <!>

`cal -3` is perfect!


Your cal likely also recognizes month names, try "cal apr" for April of this year.


Mine does not

~ $ cal apr

cal: year `apr' not in range 1..9999


Which cal? It is a relatively simple program that has seen many implementations and extensions. The cal I had in mind was the version from the util-linux package, it is commonly found in Linux distributions and supports full or abbreviated month names as arguments.


Gotcha. This is the one pre-installed on MacOS 11.6.


`cal -m 4` should work for that as well.


One of my earliest computing-adjacent exposures was going into my dad's office as a kid. Besides getting to type random things on punch-cards, we'd typically bring home these line-printer calendars with a Snoopy (or whatever) ASCII-art pic at the top.


How did I not know about cal after 20+ years of using UNIX-based systems?! Very useful!


`curl wttr.in` is my preferred `cal`


The related command ncal can provide $WeekNumber with Monday as start day:

ncal -b -M -w -B 1 -A 1


`cal 9 1752`


wish it had hyperlinks so that clicking on them would open up the date events.

speaking of, cal is just a calendar. It doesn't have events anyway.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: