9 ms·
Cal – Display a Calendar in Your Terminal
- towb 10y ago"cal" is the only calendar on my OS, who needs that other bloat. Try: cal -m I even have it aliased to "calm" :-)
- looki 10y agoThe output is the same as just "cal" for me, so I had to see what it's about: It puts Monday as the first day of the week. I guess that is because I use the German date locale. Seems that the US uses Sunday as the first day of the week in calendars and such, but does it make any difference beyond those? Don't people "feel" that Monday is the first day of the week because the weekend is over and they have to get back to work?
- schoen 10y agoPrior HN discussion about the reason for the first day of the week: https://news.ycombinator.com/item?id=11360648 https://news.ycombinator.com/item?id=11360648
- looki 10y agoInteresting, thanks.
- aji 10y agoI feel Sunday is the start of the week because that's what I've been seeing on calendars my whole life. I do bundle Mon-Fri and Sat-Sun into "weekdays" and "weekend" in my head, but when I visualize a week in my head, it always starts on Sunday.
- theophrastus 10y agotry it with 'ncal' and a capital 'M' ncal -M [year]
- jandrese 10y agoFreeBSD (17 ~): ncal -M 2016 ncal: illegal option -- M Usage: cal [general options] [-hjy] [[month] year] cal [general options] [-hj] [-m month] [year] ncal [general options] [-hJjpwy] [-s country_code] [[month] year] ncal [general options] [-hJeo] [year] General options: [-NC3] [-A months] [-B months] For debug the highlighting: [-H yyyy-mm-dd] [-d yyyy-mm]
- JdeBP 10y agoThe -M and -S options are extensions that are patched into the Debian ports of the FreeBSD ncal command. They have not been contributed back to the original, and some of the weekday calculations (that involve querying what the current locale's idea of the first day of the week is using the SUS2 nl_langinfo() library function) are tied to GNU libc. * http://anonscm.debian.org/cgit/bsdmainutils/bsdmainutils.git/tree/debian/patches/ncal_fdow.diff http://anonscm.debian.org/cgit/bsdmainutils/bsdmainutils.git... * http://anonscm.debian.org/cgit/bsdmainutils/bsdmainutils.git/tree/debian/patches http://anonscm.debian.org/cgit/bsdmainutils/bsdmainutils.git...
- zeveb 10y ago> Don't people "feel" that Monday is the first day of the week because the weekend is over and they have to get back to work? No, I feel that Sunday is the day of rest I start my week with, then I do some work, and finally I rest again: in that way my day is a microcosm of my week (and one might think that in a more primitive society my year would be a macrocosm, as I did more work spring-summer than during the winter). I personally detest calendars which display Monday as the first day of the week, and am genuinely curious why ISO chose that.
- dragonwriter 10y ago> I personally detest calendars which display Monday as the first day of the week, and am genuinely curious why ISO chose that. I think ISO chose it because there was considerable difference between countries as to what the first day of the week in usual calendar presentation was when ISO 8601 was being considered, they needed something consistent, and it just happened to shake out to Monday.
- zeveb 10y agoLooking at https://en.wikipedia.org/wiki/Names_of_the_days_of_the_week#Numbered_days_of_the_week https://en.wikipedia.org/wiki/Names_of_the_days_of_the_week#..., it appears that almost every language which numbers the days of the week starts on Sunday, with the exception of some Slavic languages (which use Monday) and Swahili (which uses Saturday).
- xobs 10y agoThe Chinese language family is a pretty big one, at least in terms of population. They all start numbering with Day One as Monday.
- coldtea 10y ago>and am genuinely curious why ISO chose that. Because ISO is all about business, and Monday is the start of the business/banking etc week.
- 10y ago
- drauh 10y agoOn OS X: cal: option requires an argument -- m usage: cal [-jy] [[month] year] cal [-j] [-m month] [year] ncal [-Jjpwy] [-s country_code] [[month] year] ncal [-Jeo] [year]
- towb 10y agoTried setting it to Swedish locale but either I did it wrong or it didn't do anything :)
- adius 10y agoJust updated the post and added a section on how to set Monday as the first day of the week.
- deleted 10y ago[deleted]
- oneeyedpigeon 10y agocal is great, but I never remember it exists. I always (OSX) go up to the menubar datetime, get annoyed that there's no kind of simple calendar underneath it (just wrap cal!), then go hunting for Google Calendar. I guess I just don't think of that kind of program as a built-in command-line one.
- hereonbusiness 10y agoI feel you, having used Linux (and I guess Windows) a lot longer than OSX this gets me every time, and every time I wonder why such a simple and useful feature was omitted.
- LeoPanthera 10y agoiStat Menus can add a calendar under the clock.
- JoshTriplett 10y agoA really fun detail in cal: ~$ cal 9 1752 September 1752 Su Mo Tu We Th Fr Sa 1 2 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
- jaybosamiya 10y agoA nice explanation here: https://unix.stackexchange.com/questions/17903/is-cal-broken-what-happened-in-september-1752 https://unix.stackexchange.com/questions/17903/is-cal-broken...
- ashmud 10y agoA bit of trivia [1] linked from that discussion about Julian calendar still in use. [1] https://en.wikipedia.org/wiki/Mount_Athos#Date_and_time_reckoning https://en.wikipedia.org/wiki/Mount_Athos#Date_and_time_reck...
- Someone 10y agoThat feature already was in 6th edition UNIX, in 1975: http://man.cat-v.org/unix-6th/6/cal http://man.cat-v.org/unix-6th/6/cal. I don't think the 5th edition had cal.
- ruggeri 10y agoKiller feature of gcal for me is that by default it highlights the current day. Didn't know about `gcal .`, which is very convenient to know; I used to do `gcal 2016` if I needed to see prev/next months.
- wyc 10y agoAnother useful command line service I use almost daily (using a rather wide terminal): $ curl wttr.in/94035 My most frequently used option for cal on GNU/Linux is "-3". It shows the current, previous, and next month with the current day highlighted, which are usually all the information I need. $ cal -3 April 2016 May 2016 June 2016 Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 2 1 2 3 4 5 6 7 1 2 3 4 3 4 5 6 7 8 9 8 9 10 11 12 13 14 5 6 7 8 9 10 11 10 11 12 13 14 15 16 15 16 17 18 19 20 21 12 13 14 15 16 17 18 17 18 19 20 21 22 23 22 23 24 25 26 27 28 19 20 21 22 23 24 25 24 25 26 27 28 29 30 29 30 31 26 27 28 29 30
- sbierwagen 10y agowttr doesn't seem to like putty+windows very much: http://i.imgur.com/45KSLFx.png http://i.imgur.com/45KSLFx.png
- deleted 10y ago[deleted]
- janvdberg 10y agoThis has to do with your character set. See Window->Translation->Remote char set. Change it to UTF-8 or the one that is on your system.
- sbierwagen 10y agoIt was in UTF-8. Part of the problem seems to be GNU Screen-- if I switch tabs, then switch back, the redraw seems to clobber some formatting characters. EDIT: LC_CTYPE wasn't set for that user, but setting it didn't fix anything. So, who knows.
- inyourtenement 10y agowttr.in looks awesome! I'm not going to complain about it, but it is a little funny that shows a big yellow sun under "Night".
- gerbilly 10y agoI once used cal as input to another program in the old days when there weren't many calendar APIs in C yet. The program produced TeX output so I could print a nice wall calendar (complete with tasks and birthdays). Was kind of klunky, but it worked.
- sgt 10y agoI use 'cal' on a daily basis. I don't find any other calendar programs to be as convenient and simple to use.
- cbr 10y agoJust don't try to use two digit format for years: ~ $ cal 5 16 May 16 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 ~ $ cal 5 2016 May 2016 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
- wtetzner 10y agoWell, it's displaying the calendar for May of the year 16, not the year 2016. I guess it could require you to enter 0016, but I think the given behavior is reasonable.
- jlas 10y agoI think better UX would be show me the closest one to today, which is 2016
- throwanem 10y agoIt's showing you the one you asked for.
- fredley 10y agoFor command line utilities I'll take correctness over usability any day.
- fosco 10y agoAgreed, this is great engineering and design. As expected, it does exactly what you tell it to.
- raverbashing 10y agoYou're right, correctness is important. And also wrong by thinking usability gets in the way of correctness Usability helps with being correct Vast majority of uses of cal apply to dates > 1900 (and I'd say a significant amount is > 2000) 'cal 16' should require a flag saying "Yes, I know what I'm doing, this is the actual year" and/or print the corresponding year for this century (being explicit, when printing, to which year it refers to)
- geofft 10y agoHuh, despite being the "GNU" calendar program, gcal is in fact generally named gcal on GNU/Linux. On my Debian GNU/Linux machine, /usr/bin/cal is from bsdmainutils, and gcal is in its own package (as with Homebrew).
- Bushra8 10y agogcal -n --astronomical-holidays
- deleted 10y ago[deleted]
- adius 10y agoJust updated the post and added this as another useful flag =)
- snorkel 10y agoGood ol cal! Circa 1998 my first homebrew web ui date picker input was just cal output redressed with html links ... And we were thankful for what we had!
- FajitaNachos 10y agoWow. Had no idea that existed. Looking forward to more tidbits
- givinguflac 10y agoncal is an interesting take on a calendar
- MikeTLive 10y agotake a walk through /usr/share/doc or go to the source: https://github.com/karelzak/util-linux https://github.com/karelzak/util-linux
- geodel 10y agoI love this original responsive and flat UI calendar and use it all the time.
- jijojv 10y agono mention of "cal -y" which should have been the default most common use option IMHO.
- sasvari 10y agoalso noteworthy: khal [0], a CLI calendar program which syncs to CalDAV servers with vdirsyncer [1]. [0] https://github.com/pimutils/khal https://github.com/pimutils/khal [1] https://github.com/pimutils/vdirsyncer https://github.com/pimutils/vdirsyncer
- LaurentGh 10y agoNo GoT joke on khal Github!
- deleted 10y ago[deleted]
- res0nat0r 10y agogcal highlighting the current date and '.' are nice features for me. $ brew info gcal gcal: stable 4 (bottled) Program for calculating and printing calendars https://www.gnu.org/software/gcal/ /usr/local/Cellar/gcal/4 (81 files, 2.8M) * Poured from bottle on 2016-01-13 at 17:03:09 From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/gcal.rb ==> Dependencies Build: xz 2016 April May June Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 2 1 2 3 4 5 6 7 1 2 3 4 3 4 5 6 7 8 9 8 9 10<11>12 13 14 5 6 7 8 9 10 11 10 11 12 13 14 15 16 15 16 17 18 19 20 21 12 13 14 15 16 17 18 17 18 19 20 21 22 23 22 23 24 25 26 27 28 19 20 21 22 23 24 25 24 25 26 27 28 29 30 29 30 31 26 27 28 29 30
- techsociety 10y agoI've been using this for ages on terminal start up with zsh.
- bootload 10y agolove Cal, call a script to use it in my .bashrc to show current date, user, day/time, logins and filesystem status. clear cal echo "Hey \033[1m$USER\033[0m it's \033[1m`date '+%A %d %B @ %T'`\033[0m" | tr '[A-Z]' '[a-z]' echo "logins:\c" ; who | wc -l df -h
- emmelaich 10y agoNote that output from .bashrc stuffs up rsync and scp, in case you use them. Enclose the lot in { .... } >&2 to send output to stderr instead. Or only output if the session is interactive, with isatty or if PS1 is set or $- contains 'i'.
- bootload 10y ago"Note that output from .bashrc stuffs up rsync and scp, in case you use them. Enclose the lot in { .... } >&2" I call a shell script from my .bashrc so does this have the same effect? I'll take this advice and wrap the script. I don't use scp or rsync but possible could at some time, thanks @emmelaich.
- mcphage 10y agoOn OSX at least, if you run it as CAL instead of cal you get a sideways calendar: mcphage:~ $ CAL May 2016 Mo 2 9 16 23 30 Tu 3 10 17 24 31 We 4 11 18 25 Th 5 12 19 26 Fr 6 13 20 27 Sa 7 14 21 28 Su 1 8 15 22 29
- drauh 10y agoAKA ncal.
- jrapdx3 10y agoYup, FreeBSD has cal and ncal. Latter has additional options for printing week numbers, date of Easter, etc., though I find it kind of hard to get used to transposed row/col output.
- inyourtenement 10y agoThat is insane. The case-insensitive filesystem means the same binary runs, but the binary has a switch on the case of its own name.
- mcphage 10y agoA lot of apps pay attention to the name you run them as—for instance, making sure the correct name is reported when you list the command line switches. But this is definitely the most extreme case I'm aware of.
- ams6110 10y agoI use cal almost every day. Way faster than phone or web page calendars.
- ams6110 10y agoFTA: I’d be really excited to hear all the use cases for gcal one can come up with. Seems really suited for a TODO list manager or to never forget a birthday again. $ man calendar CALENDAR(1) General Commands Manual CALENDAR(1) NAME calendar - reminder service SYNOPSIS calendar [-abw] [-A num] [-B num] [-f calendarfile] [-t [[[cc]yy]mm]dd] DESCRIPTION The calendar utility checks the current directory or the directory specified by the CALENDAR_DIR environment variable for a file named calendar and displays lines that begin with either today's date or tomorrow's. On Fridays, events on Friday through Monday are displayed. [...]
- MikeTLive 10y agoif you really want to go nuts - https://en.wikipedia.org/wiki/Util-linux https://en.wikipedia.org/wiki/Util-linux read all the pages, explore all the man pages, then experiment and learn.
- eknkc 10y agoI always learn about these stuff, think about using them all the time, then I totally forget until someone posts it again on HN.
- adius 10y agoYou can check out the follow up post at http://adriansieber.com/fold-wrap-lines-to-fit-in-specified-width/ http://adriansieber.com/fold-wrap-lines-to-fit-in-specified-... =)