Q. date command displays date and time under a shell? How do I display calendar under Linux or UNIX?
A. date displays the Linux or UNIX system current date and time. The cal command displays a simple calendar in traditional format and ncal offers an alternative layout, more options and the date of easter. The new format is a little cramped but it makes a year fit on a 25×80 terminal. If arguments are not specified, the current month is displayed.
cal command
Just enter cal command as follows:
$ cal
Output:
August 2007 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
ncal command
ncal command changes the output format:
$ ncal
Output:
August 2007 Mo 6 13 20 27 Tu 7 14 21 28 We 1 8 15 22 29 Th 2 9 16 23 30 Fr 3 10 17 24 31 Sa 4 11 18 25 Su 5 12 19 26
Print calendar for year 2008
$ cal 2008
Output:
2008 January February March Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 2 3 4 5 1 2 1 6 7 8 9 10 11 12 3 4 5 6 7 8 9 2 3 4 5 6 7 8 13 14 15 16 17 18 19 10 11 12 13 14 15 16 9 10 11 12 13 14 15 20 21 22 23 24 25 26 17 18 19 20 21 22 23 16 17 18 19 20 21 22 27 28 29 30 31 24 25 26 27 28 29 23 24 25 26 27 28 29 30 31 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 3 4 5 1 2 3 1 2 3 4 5 6 7 6 7 8 9 10 11 12 4 5 6 7 8 9 10 8 9 10 11 12 13 14 13 14 15 16 17 18 19 11 12 13 14 15 16 17 15 16 17 18 19 20 21 20 21 22 23 24 25 26 18 19 20 21 22 23 24 22 23 24 25 26 27 28 27 28 29 30 25 26 27 28 29 30 31 29 30 July August September Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 2 3 4 5 1 2 1 2 3 4 5 6 6 7 8 9 10 11 12 3 4 5 6 7 8 9 7 8 9 10 11 12 13 13 14 15 16 17 18 19 10 11 12 13 14 15 16 14 15 16 17 18 19 20 20 21 22 23 24 25 26 17 18 19 20 21 22 23 21 22 23 24 25 26 27 27 28 29 30 31 24 25 26 27 28 29 30 28 29 30 31 October November December Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 2 3 4 1 1 2 3 4 5 6 5 6 7 8 9 10 11 2 3 4 5 6 7 8 7 8 9 10 11 12 13 12 13 14 15 16 17 18 9 10 11 12 13 14 15 14 15 16 17 18 19 20 19 20 21 22 23 24 25 16 17 18 19 20 21 22 21 22 23 24 25 26 27 26 27 28 29 30 31 23 24 25 26 27 28 29 28 29 30 31 30
Print calendar for particular month and year
Use syntax as follows:
cal {month [1-12]} {year[1-9999]}
For example, display Jan-2007 calendar, enter:
$ cal 1 2007
Print the previous month
To print the previous month, the current month, and the next month all on one row, enter:
$ cal -3
Display Julian Calendar, if combined with the -e option, display date of easter according to the Julian Calendar.
$ cal -J
Display date of easter (for western churches)
$ cal -e
Print a calendar where Monday is the first day of the week, as opposed to Sunday.
$ cal -m
Display Julian days (days one-based, numbered from January 1).
$ cal -j
Display date of orthodox easter (Greek and Russian Orthodox Churches).
$ cal -o
Print the country codes and switching days from Julian to Gregorian Calendar as they are assumed by ncal. The country code as determined from the local environment is marked with an asterisk.
$ cal -p
Print the number of the week below each week column.
cal -w
Display a calendar for the current year.
$ cal -y
🐧 11 comments so far... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |
I dont see some of those flags in my version of cal, I am running Fedora 12 with cal from util-linux-ng 2.16
Is it GNU gcal?
how to display 3 different months in a year using cal in linux?
how to display the easater date for 100 years ??
thanx
How to use cal -s
to check when did Spain switched from the Julian to Gregorian. Can you list the detailed country codes for cal -s
how to display to display two month together using cal commend in linux
If it is prev, current and next months then you can use $cal -3
ncal -w 2013 output is different than the original week numbers. there is a shift of 1 week as per ncal -w 2013 as because week 1 of 2013 comes as week 53 .
How to display a calendar for month of march starting with monday as first day of week
how to write the command to display a calendar for a month of March starting with Monday as first day of the week.
Suppose I give “cal 2016”. How to view it page by page??
cal 2016 | more
OR
cal 2016 | less