cal ‐ #systems #utilities - five4nets/Linux-Knowledgebase GitHub Wiki

Sure! Here's a complete Markdown tutorial for using the cal command in Linux:

📅 Linux cal Command Tutorial

The cal command is a simple yet handy utility that displays a calendar in the terminal. It's useful for quickly checking dates without launching a graphical calendar app.


🧰 Basic Syntax

cal [options] [[month] year]
  • month: (Optional) Month number (1–12)
  • year: (Optional) Four-digit year
  • options: Modify output (e.g., show full year, Julian format)

🔧 Common Options

Option Description
-y Show calendar for the current year
-m Display a specific month of the current year
-3 Show previous, current, and next month
-j Display Julian calendar (day-of-year format)
-A n Show n months after the current month
-B n Show n months before the current month
-n Show calendar for the next n months
-S Show calendar spanning the current date
--monday Start the week on Monday instead of Sunday

🧪 Examples

1. Show the current month

cal

2. Show the full calendar for the current year

cal -y

3. Show a specific month and year (e.g., August 2025)

cal 8 2025

4. Show the calendar for a specific year

cal 2023

5. Show the previous, current, and next month

cal -3

6. Show the calendar in Julian format

cal -j

7. Show a specific month of the current year

cal -m 6

8. Show 2 months before and 2 months after the current month

cal -B 2 -A 2

🧠 Pro Tips

  • Use man cal to view the full manual.
  • Combine options for custom views, like:
    cal -m 12 -y
    

📚 References


Happy calendaring! 🗓️


Let me know if you'd like this saved as a file or expanded with `ncal` examples too!