cal Linux Commands

What is Linux cal Command?

Explanation

cal COMMAND:

cal command is used to display the calendar.

SYNTAX :


cal [options] [month] [year]

OPTIONS:


-1 Displays single month as output.
-3 Displays prev/current/next month output.
-s Displays sunday as the first day of the week.
-m Displays Monday as the first day of the week.
-j Displays Julian dates (days one-based, numbered from January 1).
-y Displays a calendar for the current year.

EXAMPLE:


  1. cal
    Output:

    September 2008
    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

    cal command displays the current month calendar.
  2. cal -3 5 2008
    Output:

    April 2008
    May 2008
    June 2008
    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

    Here the cal command displays the calendar of April, May and June month of year 2008.

Ask Questions

Ask Question