Using date command to print the current date
I am trying to find a way to use the date
linux command to print Today is June 8, 2021
A search in man pages didn't reveal anything containing Today is
in output
Is it possible to use just date
command to print the current date in the above format
Solution 1:
Use Today is
in the format verbatim:
date '+Today is %B %-d, %Y'
See man 1 date
to learn about tokens like %B
. Note %-d
prints 8
where %d
would print 08
.
%B
prints locale's full month name. In any English locale the above command should just work. If your locale is non-English then you need to set LC_TIME
to some English locale to get June
. C
locale should be available in any system and it will give you English month names:
LC_TIME=C date '+Today is %B %-d, %Y'