date:tldr:5fc73
The date
command is an executable program that is available in most Linux and Unix-like operating systems. When the date
command is run, it displays the current date and time according to the system's clock. By default, the date
command outputs the date and time in the format defined by the system's locale settings. However, you can specify a custom format using various options and formatting codes. For example, running date
without any options will simply display the current date and time: $ date Mon Oct 25 15:30:20 UTC 2021
You can also specify a custom format using the +
option followed by formatting codes. For instance, to display the date and time in the format "YYYY-MM-DD hh:mm:ss", you can execute: $ date +'%Y-%m-%d %H:%M:%S' 2021-10-25 15:30:20
The date
command is not only used to display the current date and time but also to set or manipulate the system's clock. However, changing the system's clock usually requires root or administrative privileges. Additionally, the date
command allows you to convert or calculate dates by specifying a specific time or date using relative or absolute values. Overall, the date
command is commonly utilized for displaying, setting, or manipulating the date and time on Linux and Unix-like systems.