Get the App
SLTechnology News&Howtos  ›  Servers  › 

Use the cal command of linux to display the calendar

Shulou Source: shulou.com Published: 2022-06-02 18:07:00 09月28日 Update

Do not know how to use the cal command linux calendar display? In fact, it is not difficult to solve this problem. Let Xiaobian take you to learn how to solve it together. I hope you will gain a lot after reading this article.

The cal command takes its name from the English word Calendar. Change the command to display the current calendar, or the Gregorian calendar of the specified date (Gregorian calendar is now the international calendar, also known as Gregorian calendar, commonly known as Gregorian calendar). If there is only one parameter, it represents the year (1-9999), and if there are two parameters, it represents the month and year.

Syntax format: cal [parameter] [month] [year]

Common parameters:

-l Single Month Minute Output Calendar-3 Display calendar of last three months-s Set Sunday as first day of month-m Set Monday as first day of month-j Display day of year (Julian Day)-y Display calendar of year

Reference Example

Calendar showing current month:

[root@linuxcool ~]# cal

April 2019

Day one, two, three, four, five, six.

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

Calendar showing the last three months (current month, previous month and next month):

[root@linuxcool ~]# cal -3

March 2019 April 2019 May 2019

Day one, two, three, four, five, six, one, two, three, four, five, six, one, two, three, four, five, six.

1 2 1 2 3 4 5 6 1 2 3 4

3 4 5 6 7 8 9 7 8 9 10 11 12 13 5 6 7 8 9 10 11

10 11 12 13 14 15 16 14 15 16 17 18 19 20 12 13 14 15 16 17 18

17 18 19 20 21 22 23 21 22 23 24 25 26 27 19 20 21 22 23 24 25

24 25 26 27 28 29 30 28 29 30 26 27 28 29 30 31

31

Calendar showing the specified year and month, such as calendar showing February 2020:

[root@linuxcool ~]# cal 2 2020

February 2020

Day one, two, three, four, five, six.

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 Thank you for reading this article carefully, hope Xiaobian share the use of linux cal command display calendar content is helpful to everyone, but also hope that everyone more support, pay attention to industry information channels, encounter problems to find, detailed solutions waiting for you to learn!

Tags: Calendar command parameter year month three Gregorian calendar week article question study two content single month word calendar also known as only at the same time name Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information Redmi MySQL Xiaomi macOS