Questions tagged [cal]

cal is a command line application which displays an ASCII calendar along with the current date.

Summary

cal is an application used to display a calendar in the terminal. It can be used to invoke the current month & day (default behaviour) or it can accept arguments to display different months of different years.

External reference

36 questions
30
votes
2 answers

Is `cal` broken? What happened in September 1752?

If you look at the output of cal 9 1752 you will see this strange output: September 1752 S M Tu W Th F S 1 2 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 The following story titled "cal 9 1752 explained"" was copied off of a…
LanceBaynes
  • 39,295
  • 97
  • 250
  • 349
17
votes
2 answers

Current date in cal is not highlighted in recent Debian

As answered in Highlight the current date in cal the current date in output form cal is automatically highlighted (reverse colors) if the output goes to terminal. That's what I had always been getting. However, with my current Debian GNU/Linux, it…
xpt
  • 1,182
  • 2
  • 13
  • 32
8
votes
7 answers

Highlight the current date in cal

I would like to highlight today's date in the output of the cal command. What is the best way? This is what I have so far: cal -m | grep -C6 --color "$(date +%e)" but it doesn't work for all cases e.g, when the date has a single digit. I also want…
dogbane
  • 29,087
  • 16
  • 80
  • 60
7
votes
4 answers

Output current day using cal

I'm asked to output the current day using the cal command. So far, I discovered that before the current date there is a _ symbol. I decided to use grep here: cal | grep '\b_*', but it outputs the whole week. I've tried several variants, but it…
Welez
  • 181
  • 5
6
votes
1 answer

How to emphasize holidays by color in `cal` command

I want to emphasize holidays by color in cal or similar command. I'm using OS X and Ubuntu 14, is there easy way to enable the function?
ironsand
  • 5,085
  • 12
  • 50
  • 73
5
votes
2 answers

Is it possible to allow a background process to continuously output to terminal?

Here's a use-case to clarify my question. Say I have a calendar program that is set to run in ~/.bashrc, and it ensures the streaming output overwrites the same block of lines. Is it possible to have the streaming output display in the terminal from…
5
votes
2 answers

How can I make the `cal` tool in OSX highlight the current day?

In Ubuntu and Fedora, when I type cal on the command line I get an ASCII calendar with the current day highlighted. In OSX, when I type cal, I get an ASCII calendar but no day is highlighted. How can I get the highlighting of the current date in…
merlin2011
  • 3,855
  • 5
  • 27
  • 36
4
votes
1 answer

How to make ncal -b -3 give consistent output?

It looks like that the format of the month headings in ncal changes with the month. For example: $ ncal -bh -3 -m 2 2021 Gennaio Febbraio Marzo lu ma me gi ve sa do lu ma me gi…
renyhp
  • 143
  • 4
4
votes
2 answers

How to make FreeBSD variant of cal start weeks on mondays?

Can week start day be changed in cal output? Is it hardcoded? Notice: not the ncal.
int_ua
  • 243
  • 1
  • 7
4
votes
2 answers

Why does 'cal' use weird 08 / ^H / \b terminal code for highlighting and how does that work?

When you run cal on Linux, the output for the current month will reverse video highlight the current day. When I send that output to hexdump -c, I get some interesting results: 0000000 N o v e m b e r 2 0 1 …
deltaray
  • 1,301
  • 2
  • 11
  • 19
4
votes
2 answers

Multi-month view in calendar (cal) in OS X

I am hoping to run some of the commands listed in this article, e.g.: cal -3 which is supposed to show me the last month, this month, and next month. This command does not work in OS X. $ cal -3 cal: illegal option -- 3 usage: cal [-jy] [[month]…
Amelio Vazquez-Reina
  • 40,169
  • 77
  • 197
  • 294
3
votes
1 answer

Why does `ncal -p` say that "Latin" switched from Julian to Gregorian calendar on 9999-05-31?

I ran ncal -p to print the switching days from the Julian to the Gregorian Calendar, and I see this: AL Albania 1912-11-30 IT Italy 1582-10-04 AT Austria 1583-10-05 JP Japan 1918-12-18 AU Australia …
Flux
  • 2,516
  • 4
  • 20
  • 45
3
votes
1 answer

Cal no space delimiter

I am an OpenBSD user and I am writing an awk script which automatically generates TeX course calendars for all courses that I teach. To obtain actual calendar out of the system I use Unix cal command. The problem is that the output of the cal…
3
votes
4 answers

bash script that reads user input and uses "cal" command to validate dates

I want to write a script that reads my input (for example if my script is called "check", then I would type "check 9 4 1993" and that input would go through the cal command and will check through the calendar whether it is a valid date or not). My…
grinke
  • 31
  • 1
  • 3
3
votes
2 answers

Highlight today in Mac's cal

Every Mac comes with cal which shows a simple calendar of current month. Output is something like this: February 2014 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 I…
Mohsen
  • 2,495
  • 4
  • 25
  • 29
1
2 3