To display the current date and time in Linux, you can use the date
command.
To display the date and time in the format Weekday Month Day HH:MM:SS Timezone Year
, you can use the following command:
date
This will output the date and time in the format described above, for example:
Fri Feb 19 15:45:30 UTC 2023
If you want to display the date and time in a specific format, you can use the +
option followed by a format string. For example, to display the date and time in the format YYYY-MM-DD HH:MM:SS
, you can use the following command:
date +'%Y-%m-%d %H:%M:%S'
This will output the date and time in the format YYYY-MM-DD HH:MM:SS
, for example:
2023-02-19 15:45:30
You can customize the format string as needed to display the date and time in any desired format.