Raspberry Pi_Eng_10.10.2 “cal” Command and “ncal” Command


Published Book on Amazon


All of IOT Starting with the Latest Raspberry Pi from Beginner to Advanced – Volume 1
All of IOT Starting with the Latest Raspberry Pi from Beginner to Advanced – Volume 2


출판된 한글판 도서


최신 라즈베리파이(Raspberry Pi)로 시작하는 사물인터넷(IOT)의 모든 것 – 초보에서 고급까지 (상)
최신 라즈베리파이(Raspberry Pi)로 시작하는 사물인터넷(IOT)의 모든 것 – 초보에서 고급까지 (하)


Original Book Contents


10.10.2   "cal" Command and "ncal" Command

 

This command performs the function to print the calendar. While the "cal" command shows it in the traditional calendar format with a simpler type, the "ncal" command can display it in a variety of formats and use various options.

The following describes the usage format for the "cal" command.

 

[Command Format]

cal [-3hjy] [-A number] [-B number] [[month] year]

cal [-3hj] [-A number] [-B number] -m month [year]

 

The following describes the usage format for the "ncal" command.

 

[Command Format]

ncal [-3bhjJpwySM] [-A number] [-B number] [-s country_code] [[month] year]

ncal [-3bhJeoSM] [-A number] [-B number] [year]

ncal [-CN] [-H yyyy-mm-dd] [-d yyyy-mm]

 

[Command Overview]

   This prints the calendar of the specified date.

   User privilege          -- Normal user.

 

[Detail Description]

   None

 

[Main Option]

-J

Display Julian Calendar, if combined with the -o option, display date of Orthodox Easter according to the Julian Calendar.

-e

Display date of Easter (for western churches).

-m month

 

Display the specified month.  If month is specified as a decimal number, appending f or p displays the same month of the following or previous year respectively.

-w

Print the number of the week below each week column.

-y

Display a calendar for the specified year. This option is implied when a year but no month are specified on the command line.

-3

Display the previous, current and next month surrounding today.

-1

Display only the current month. This is the default.  Manual page cal(1) line 19 (press h for help or q to quit)

-d yyyy-mm

Use yyyy-mm as the current date (for debugging of date selection).

-H yyyy-mm-dd

Use yyyy-mm-dd as the current date (for debugging of highlighting).

 

[Used Example]

The following prints the current month's calendar.

 

pi@raspberrypi ~ $ cal

June 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

 

The following example prints the calendar for August 2015.

 

pi@raspberrypi ~ $ cal -d 2015-08

August 2015

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