Questions tagged [cal]

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

Filter by
Sorted by
Tagged with
0 votes
0 answers
17 views

highlight several dates in a year with gcal

cal or gcal are linux terminal programs which display a calendar gcal 2023 displays the entire year 2023 This question explains how to make it highlight todays date in the current year - Highlight the ...
cardamom's user avatar
  • 550
-1 votes
1 answer
77 views

Why can GNU cal (the CLI calendar utility) send email messages?

The GNU cal utility has an option to send an email message to someone with its output: --mail[=address] Send Gcal’s output via mail program to the given address, e.g.: [email protected] If no ...
karolba's user avatar
  • 216
1 vote
1 answer
29 views

Can `cal` show other Gregorian adoptions?

On my host I can show the adoption of the Gregorian calendar as it occurred for Great Britain and its colonies in 1752: $ cal september 1752 September 1752 Su Mo Tu We Th Fr Sa 1 2 ...
therealneil's user avatar
1 vote
1 answer
454 views

display range of specified months with ncal

Is it possible to display specific months in ncal? For example, ncal -m1 will display January, but what if I want to display January and February? I've tried ncal -m1,2 with no luck.
Wakan Tanka's user avatar
18 votes
2 answers
2k views

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 ...
xpt's user avatar
  • 1,488
-2 votes
3 answers
134 views

How to append a string to every cell (with awk)?

This is an output of cal. What is the simplest way to append an additional <SPACE> to every cell? June 2021 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 ...
user avatar
0 votes
1 answer
116 views

How to manipulate the cal command question [closed]

I'm stuck on a question on my homework and can't figure the right options and pipes to use of cal or ncal. The question is the following: Write a command line to find the number of Monday(s) that fall(...
William's user avatar
  • 153
4 votes
1 answer
54 views

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 ...
renyhp's user avatar
  • 143
0 votes
1 answer
30 views

Printing Jan, Feb, March and April of 2020 with Cal [closed]

I learnt brace expansion today and tried the following command $ cal {1...4} 2020 I expected the output to display the calendar of Jan, Feb, March and April for the year 2020. But I got the following ...
Samarth Goel's user avatar
2 votes
1 answer
378 views

How can I recursively create output files by passing directory names as parameters?

I'm trying to solve a problem involving recursive file creation and nested subdirectories. I've written a command to create the following nested directory structure: mkdir -p {2019,2020}/{01..03} ...
rabbittas2739's user avatar
0 votes
1 answer
308 views

How do `cal` options work?

cal doesn't work with any options. cal -M returns Usage: cal [general options] [-jy] [[month] year] cal [general options] [-j] [-m month] [year] ncal -C [general options] [-jy] [[month] ...
alec's user avatar
  • 1,688
2 votes
1 answer
573 views

Launching urxvt with calendar (cal) using sxhkd

Hi I'm trying to launch cal with sxhkd. And it doesn't work, the terminal window is closed right after the command is executed. I tried to do it using the following: # launch urxvt 20x8 with cal super ...
user419050's user avatar
3 votes
1 answer
447 views

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 ...
Flux's user avatar
  • 2,898
1 vote
1 answer
227 views

How to out the output of the command 'cal' to csv.?

How can I format the output of the command cal -y 2020 as a csv? I want to prepare the calendar in a table processor. Can this be done? I am using Slackware 14.2.
dymdin's user avatar
  • 21
0 votes
2 answers
977 views

Pick off 'first' dates using cal function in bash

I'm trying to pick off the first Monday, second Tuesday, second Saturday, etc. out of the cal function and piping awk commands. For this month, I can get the first Tuesday correctly with the command ...
kstats9pt3's user avatar
-5 votes
2 answers
2k views

One liner required to get last working day for previous month [closed]

E.g. today is 06/04/2018; the desired output is 05/31/2018. For 07/01/2018 the output should be 06/29/2018.
love sharma's user avatar
-1 votes
4 answers
334 views

How can get the list of all Saturdays in a given date range ex: 20170101 to 20170630 in YYYYMMDD format in linux?

I need to get the list of all Saturdays in a given date range ex: 20170101 to 20170630 in YYYYMMDD format in linux
Ananth's user avatar
  • 11
5 votes
2 answers
1k views

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 ...
Patrick Roberts's user avatar
7 votes
4 answers
2k views

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 ...
Welez's user avatar
  • 181
-2 votes
2 answers
651 views

Calendar to Cal displaying schedule [closed]

I don't understand how to create a txt to use the calendar utility to display "notes"
19oct3rLP's user avatar
0 votes
1 answer
124 views

Why is that `ncal -CM` doesn't work but `ncal -MC` does?

I wanted to put a calendar in a file so I ran: $ ncal -CMh > file.txt But instead I received the following: Usage: cal [general options] [-hjy] [[month] year] cal [general options] [-hj] [...
ihato's user avatar
  • 295
5 votes
2 answers
816 views

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 ...
deltaray's user avatar
  • 1,338
0 votes
2 answers
762 views

How to display each day of a month on a separate line using tr, sed and cal

How to use commands, cal, sed and tr and the pipe to display the numerical days (e.g., 1, 2, 3, etc.) of a month, with each day on a separate line I've tried: cal 12 2015| sed '3,7p' | tr -cs "[:...
NOOBCAKE's user avatar
2 votes
1 answer
171 views

Zeller's congruence and cal command

According to Zeller's Congruence, the day of 29 Feb, 1600 is Tuesday. However, the cal command shows it as Friday.Is there a bug in cal's code or a limit on the range of years which Zeller's ...
vishnuvp's user avatar
  • 123
5 votes
2 answers
2k views

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 ...
merlin2011's user avatar
  • 3,925
0 votes
3 answers
3k views

How to Print the calendar for March and April 2015 and show the calendar entries side-by-side? using UNIX

how to Print the calendar for March and April 2015 and show the calendar entries side-by-side? in UNIX
hdabaja's user avatar
  • 131
4 votes
2 answers
2k views

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 ...
Amelio Vazquez-Reina's user avatar
2 votes
1 answer
1k views

calendar to check the date and then search 3 months back and add up the days of those months

I want to use the cal command or the date command to display the current day, then I want it to display 3 months before the current date, then add up all the days in those 3 months up to the current ...
user avatar
6 votes
1 answer
5k views

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's user avatar
  • 5,195
3 votes
4 answers
4k views

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 ...
grinke's user avatar
  • 31
0 votes
1 answer
166 views

how to write this if command?

my script name is 1. when i type in "1 2012 12 12". it shows current date calendar and when i enter a invaild date like "1 2323232" cal gives me a error so how could i put that in if loop that if it ...
user3504970's user avatar
3 votes
2 answers
711 views

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 ...
Mohsen's user avatar
  • 2,575
2 votes
1 answer
583 views

Julian calendar for a UK locale in ncal

On my machine, ncal identifies my country code as GB, and use that to find the date for the shift to the gregorian calendar, and I think cal uses the same date by default: cal: $ cal 09 1752 ...
dgel's user avatar
  • 21
4 votes
2 answers
2k views

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's user avatar
  • 243
3 votes
1 answer
363 views

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. ...
Predrag Punosevac's user avatar
31 votes
2 answers
35k views

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 ...
LanceBaynes's user avatar
9 votes
7 answers
10k views

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 ...
dogbane's user avatar
  • 29.6k