What are common date command options?

0164

Here are some common options for the date command in Linux:

  1. +FORMAT: Customize the output format. For example:

    date "+%Y-%m-%d %H:%M:%S"

    This will display the date in the format YYYY-MM-DD HH:MM:SS.

  2. -u: Display the date and time in Coordinated Universal Time (UTC).

    date -u
  3. -d STRING: Display the date and time described by the STRING. For example:

    date -d "next Friday"
  4. -s STRING: Set the system date and time to the specified STRING. This usually requires superuser privileges.

    sudo date -s "2023-10-01 12:00:00"
  5. -R: Display the date in RFC 2822 format.

    date -R
  6. -I: Output the date in ISO 8601 format.

    date -I

These options allow you to format and manipulate date and time information effectively.

0 Comments

no data
Be the first to share your comment!