Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

cal (command)

From Wikipedia, the free encyclopedia
Shell command for printing a calendar
cal
Thecal command as shown in aLinuxzsh session inArch Linux
DeveloperCharles Dye
Initial releaseNovember 3, 1971; 54 years ago (1971-11-03)
Written inPlan 9:C
FreeDOS:x86 assembly language
Operating systemUnix,Unix-like,Plan 9,Inferno,MSX-DOS,FreeDOS
PlatformCross-platform
TypeCommand
Licenseutil-linux:BSD-4-Clause
FreeDOS:Freeware /Source-available software
Plan 9:MIT License

cal is ashellcommand that prints acalendar asASCII text for one or moremonths. With nocommand-line options, it prints a calendar for the current month.

It is specified in theSingle UNIX Specification and available on variousoperating systems includingUnix,Plan 9,Inferno andUnix-like systems such asLinux. It was present in1st Edition Unix. Acal command is also part ofASCII'sMSX-DOS2 Tools forMSX-DOS version 2.[1] It is also available forFreeDOS (developed by Charles Dye) in which it supports the Gregorian calendar (new style) and may be distributed freely, with or without source.[2]

Examples

[edit]

The following prints the current month calendar which in this case happens to be Feb. 2024.

$cal    February 2024 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

The following prints a calendar for the previous, current and next month.

$cal-3     June 2022             July 2022            August 2022Su 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  2      1  2  3  4  5  6 5  6  7  8  9 10 11   3  4  5  6  7  8  9   7  8  9 10 11 12 1312 13 14 15 16 17 18  10 11 12 13 14 15 16  14 15 16 17 18 19 2019 20 21 22 23 24 25  17 18 19 20 21 22 23  21 22 23 24 25 26 2726 27 28 29 30        24 25 26 27 28 29 30  28 29 30 31

The following prints a calendar for each month of 2023.

$cal2023                            2023      January               February               MarchSu 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  6  7            1  2  3  4            1  2  3  4 8  9 10 11 12 13 14   5  6  7  8  9 10 11   5  6  7  8  9 10 1115 16 17 18 19 20 21  12 13 14 15 16 17 18  12 13 14 15 16 17 1822 23 24 25 26 27 28  19 20 21 22 23 24 25  19 20 21 22 23 24 2529 30 31              26 27 28              26 27 28 29 30 31       April                  May                   JuneSu Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa                   1      1  2  3  4  5  6               1  2  3 2  3  4  5  6  7  8   7  8  9 10 11 12 13   4  5  6  7  8  9 10 9 10 11 12 13 14 15  14 15 16 17 18 19 20  11 12 13 14 15 16 1716 17 18 19 20 21 22  21 22 23 24 25 26 27  18 19 20 21 22 23 2423 24 25 26 27 28 29  28 29 30 31           25 26 27 28 29 3030        July                 August              SeptemberSu Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa                   1         1  2  3  4  5                  1  2 2  3  4  5  6  7  8   6  7  8  9 10 11 12   3  4  5  6  7  8  9 9 10 11 12 13 14 15  13 14 15 16 17 18 19  10 11 12 13 14 15 1616 17 18 19 20 21 22  20 21 22 23 24 25 26  17 18 19 20 21 22 2323 24 25 26 27 28 29  27 28 29 30 31        24 25 26 27 28 29 3030 31      October               November              DecemberSu 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  6  7            1  2  3  4                  1  2 8  9 10 11 12 13 14   5  6  7  8  9 10 11   3  4  5  6  7  8  915 16 17 18 19 20 21  12 13 14 15 16 17 18  10 11 12 13 14 15 1622 23 24 25 26 27 28  19 20 21 22 23 24 25  17 18 19 20 21 22 2329 30 31              26 27 28 29 30        24 25 26 27 28 29 30                                            31

The following prints a calendar for the June 2023. A month is specified by its number (1-12) in the year.

$cal62023      June 2023Su Mo Tu We Th Fr Sa             1  2  3 4  5  6  7  8  9 1011 12 13 14 15 16 1718 19 20 21 22 23 2425 26 27 28 29 30

Quirks (1752)

[edit]
Further information:Calendar (New Style) Act 1750
$cal91752  September 1752 S  M Tu  W Th  F  S       1  2 14 15 1617 18 19 20 21 22 2324 25 26 27 28 29 30

TheGregorian calendar reform was adopted by theKingdom of Great Britain, includingits possessions in North America (later to become eastern USA and Canada), in September 1752. As a result, the September 1752 cal shows the adjusted days missing. This month was the official (British) adoption of the Gregorian calendar from the previously usedJulian calendar. This has been documented in the man pages for Sun Solaris as follows. "An unusual calendar is printed for September 1752. That is the month when 11 days were skipped to make up for lack of leap year adjustments."[3] ThePlan 9 from Bell Labs manual states: "Trycal sep 1752." Date of adoption of the reformdiffers widely between countries so, for some users, this feature may be a bug. Special handling of 1752 is known to have appeared as early as the first edition of theUnix Programmer's Manual in 1971.[4]

See also

[edit]

References

[edit]
  1. ^"MSX-DOS2 Tools User's Manual - MSX-DOS2 TOOLS ユーザーズマニュアル". April 1, 1993 – via Internet Archive.
  2. ^"ibiblio.org FreeDOS Package -- cal (Unix-like)".www.ibiblio.org.Archived from the original on 2020-02-22. Retrieved2020-01-27.
  3. ^"Synopsis - man pages section 1: User Commands".docs.oracle.com.Archived from the original on 2019-05-09. Retrieved2016-06-23.
  4. ^Thompson, K.; Ritchie, D. M. (1971).Unix Programmer's Manual (First ed.). Bell Telephone Laboratories. pp. cal (VI).Archived from the original on 2023-02-05. Retrieved2023-04-09.

Sources

[edit]

External links

[edit]
The WikibookGuide to Unix has a page on the topic of:Commands
File system
Processes
User environment
Text processing
Shell builtins
Searching
Documentation
Software development
Miscellaneous
File system
Processes
User environment
Text processing
Shell builtins
Networking
Searching
Software development
Miscellaneous
Standards
Active
development
Discontinued
Retrieved from "https://en.wikipedia.org/w/index.php?title=Cal_(command)&oldid=1336335332"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2026 Movatter.jp