Date & Calendar

date

Print or set the system date and time.

Example:

  1. Simple usage of date to display current date & time.

    $ date
    Fri Aug 21 18:25:31 IST 2020
    
  2. Set system time using -s or --setcommand.

    $ date -s "11/20/2021 12:30:00"
    
  3. Format the date that is printed using the following

    //tab
    +----------------+------------------------------------+
    | Format         | Specifies                          |
    +----------------+------------------------------------+
    | +%m            | Month number                       |
    | +%h            | Abbrivieated month (Jan, Feb, etc) |
    | +%B            | Full month name                    |
    | +%d            | Day of the month                   |
    | +%y            | Year                               |
    | +%H, +%M & +%S | Hour, minute & seconds             |
    | +%D            | Date as mm/dd/yy                   |
    | +%T            | Time as hh:mm:ss                   |
    +----------------+------------------------------------+
    
    $ date "+%d-%h-%y"
    21-Aug-20 
    

cal

Displays a calendar.

<aside> 💡 Use ncal for an alternative layout.

</aside>

Example:

  1. Simple use of cal

    $ cal
        August 2020
    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 31 
    
  2. Use -y to display the calendar of the specified year.

  3. Use -m to display the calendar of the specified month (month is a decimal number).


Miscellaneous

alias

Define or display aliases. Without arguments, alias' prints the list of aliases in the reusable form alias NAME=VALUE on standard output.

Syntax: alias [-p] [name=value]