Timestamps in unix with the date command

If you need the textual date, "date", will suffice.

If you need it in RFC2822, "date -R" will do that.

If you need it in unix format, "date +"%s" will do that.

And finally, a format the fits well with file names is "date +"%F"


$ date
Mon 23 Jun 08:45:15 BST 2014
$ date -R
Mon, 23 Jun 2014 08:45:18 +0100
$ date +"%s"
$ date +"%F"

To enter any of these in the command line:

touch hi_$(date +"%F")_there.txt
unix unix-date

Edit on github
comments powered by Disqus
Click me