• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

cal Command Examples in Linux

by admin

The wonderful cal command can tell you a lot. Entered without any arguments, it shows you a calendar for the current month that looks like this:

$ cal
     April 2022
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

But there are several arguments you can add to the cal command to tell you even more. The Julian date, for example. Try this:

$ cal -j 1 2022

The example above produces a rather normal looking calendar, but the -j argument changes it from showing the day of the month (1-31 for January) to the Julian date, or day of the year, instead.

Of course for January, it’s hard to tell the difference. Try this:

$ cal -j 2 2022
       February 2022
 Su  Mo  Tu  We  Th  Fr  Sa
         32  33  34  35  36
 37  38  39  40  41  42  43
 44  45  46  47  48  49  50
 51  52  53  54  55  56  57
 58  59

cal Command Examples

1. To display the calender for 2011:

# cal 2011

2. To display single month output:

# cal -1

3. To display previous/current/next month output:

# cal -3

4. To display Sunday as a first day:

# cal -s

5. To display monday as a first day of the output:

# cal -m

6. To display the Julian dates:

# cal -j

7. To display the calender of current year:

# cal -y

8. To display the version information:

# cal -V

Final Thoughts

The cal command writes a Gregorian calendar to standard output. If you specify a four-digit year operand, a calendar for that year is written. If you specify no operands, a calendar for the current month is written. You can display a calendar for any month of any year by specifying the month, as a digit from 1 to 12, followed by any four-digit year up to 9999.

Filed Under: Linux

Some more articles you might also be interested in …

  1. CentOS / RHEL : How to convert volume group metadata between LVM1 and LVM2
  2. mdadm Command Examples in Linux
  3. abbr Command Examples in fish-shell
  4. “aws sqs” Command Examples
  5. hardinfo Command Examples in Linux
  6. dmenu: command not found
  7. What are the mount options to improve ext4 filesystem performance in Linux
  8. How to show line numbers in Gedit
  9. qm shutdown Command Examples
  10. hn Command Examples

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright