Current Date on Shell

Posted August 1, 2016 by Adrian Wyssmann ‐ 1 min read

To display the current date on the shell you use the date command

[[email protected]]$ date
Fri Jan 1 08:08:10 UTC 2016

So this format may not fit your need, therefore you would adjust the format by the +FORMAT parameter as described in the help

date +FORMAT

As an example do display the date in format yyyymmddhhmm you would type

[[email protected]]$ date +%Y%m%d%H%M

which will display


If you want to use the outcome of the command as value for further commands, just enclose them in `

[[email protected]]$ script console_`date +%Y%m%d%H%M`.txt
Script started, file is console_201601010808.txt