What is the use of date command?

The date command in Linux is used to display the current date and time. It can also format the output in various ways. Here are some common uses:

  1. Display Current Date and Time:

    date
  2. Display Current Date and Time in UTC:

    date -u
  3. Format Date and Time:
    You can format the output using specific placeholders. For example:

    date +'%A, %Y-%m-%d, %H:%M'

    This command will display the date in a format like "Monday, 2023-10-02, 14:30".

The date command is useful for logging, scheduling tasks, and displaying time-related information in scripts.

0 Comments

no data
Be the first to share your comment!