Gcal is a Linux program for calculating and printing calendars. It's similar to the standard calendar program (cal) but has more features and shows Monday as the first day of the week by default.
For a basic calendar of the current month you don’t need any options, just a
simple gcal
will do. Note that when you use gcal
in your terminal the
current day will be highlighted despite the fact that the following code blocks
don’t illustrate that.
# Current month
root@planetroast:~$ gcal
August 2022
Mo Tu We Th Fr Sa Su
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
# 3 month view with next month and previous month
root@planetroast:~$ gcal .
July August September
Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su
1 2 3 1 2 3 4 5 6 7 1 2 3 4
4 5 6 7 8 9 10 8 9 10 11 12 13 14 5 6 7 8 9 10 11
11 12 13 14 15 16 17 15 16 17 18 19 20 21 12 13 14 15 16 17 18
18 19 20 21 22 23 24 22 23 24 25 26 27 28 19 20 21 22 23 24 25
25 26 27 28 29 30 31 29 30 31 26 27 28 29 30
# More options
gcal .+ # Current month + next 2 months
gcal .- # Current month + previous 2 months
gcal 2-5 # Specific months (displays in a column layout)
gcal 1969 # All months of a specific year (requires yyyy format)
Sometimes it’s easier to use the calendar in a layout where the weekdays are
displayed vertically so for that there’s the -i
option. I find this layout
useful when combined with the week numbers option (more on that below).
root@planetroast:~$ gcal -i
August 2022
Monday 1 8 15 22 29
Tuesday 2 9 16 23 30
Wednesday 3 10 17 24 31
Thursday 4 11 18 25
Friday 5 12 19 26
Saturday 6 13 20 27
Sunday 7 14 21 28
Using the -j
option enables ‘special date format’ which replaces the day of
the month with the day of the year. I don’t find this very useful as usually I
need to associate a day of the year with a specific date or vice versa, and so
it’s best to use -jb
which shows both the day of year and of the month.
# Day of the year (including day of the month)
root@planetroast:~$ gcal -jb
August 2022
Mon Tue Wed Thu Fri Sat Sun
1(213) 2(214) 3(215) 4(216) 5(217) 6(218) 7(219)
8(220) 9(221) 10(222) 11(223) 12(224) 13(225) 14(226)
15(227) 16(228) 17(229) 18(230) 19(231) 20(232) 21(233)
22(234) 23(235) 24(236) 25(237) 26(238) 27(239) 28(240)
29(241) 30(242) 31(243)
# Day of the year (without day of the month)
root@planetroast:~$ gcal -j
August 2022
Mon Tue Wed Thu Fri Sat Sun
213 214 215 216 217 218 219
220 221 222 223 224 225 226
227 228 229 230 231 232 233
234 235 236 237 238 239 240
241 242 243
Display the week numbers using the -K
option. In the default layout this
appends a column to the calendar and in the alternative layout it appends a row
underneath.
# Week numbers (normal layout)
root@planetroast:~$ gcal -K
August 2022
Mo Tu We Th Fr Sa Su CW
1 2 3 4 5 6 7 31
8 9 10 11 12 13 14 32
15 16 17 18 19 20 21 33
22 23 24 25 26 27 28 34
29 30 31 35
# Week numbers (alternative layout)
root@planetroast:~$ gcal -i -K
August 2022
Monday 1 8 15 22 29
Tuesday 2 9 16 23 30
Wednesday 3 10 17 24 31
Thursday 4 11 18 25
Friday 5 12 19 26
Saturday 6 13 20 27
Sunday 7 14 21 28
Week 31 32 33 34 35