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
dev@codetryout:~$ date +%F
2020-02-03
dev@codetryout:~$
The regular way of printing Linux date
dev@codetryout:~$ date +%Y-%m-%d
2020-02-03
dev@codetryout:~$
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 🙂