There is a quick way to date the current date in full with one parameter, reference from the date man page says %F full date; same as %Y-%m-%d
Let us explore:
Printing full date in bash quickly
date +%F
Examples and comparisons on how to print full date in bash.
Printing date with the shortcode
[email protected]:~$ date +%F
2020-02-03
[email protected]:~$
The regular way of printing Linux date
[email protected]:~$ date +%Y-%m-%d
2020-02-03
[email protected]:~$
This works in any bash shell, Linux/RHEL/CentOS/Ubuntu/Docker containers/WSL, etc.
I hope this is helpful to make your next script shorter 🙂