touch "foo.backup.$(date +%F_%R)" | date +'%j' #day of year

touch "foo.backup.$(date +%F_%R)"


$ ll foo*
-rw-rw-r-- 1 saml saml 0 Oct 16 19:25 foo.backup.2013-10-16_19:25
Additional formats

If you want to take full control if you consult the man page you can do things like this:
$ date +"%Y%m%d"
20131016

$ date +"%Y-%m-%d"
2013-10-16

$ date +"%Y%m%d_%H%M%S"
20131016_193655
ubu1404@ubuntu1404lb01:~$
date +'%j' 063 #day

Comments

Popular posts from this blog

HAproxy logging

tomcat catalina coyote jasper cluster

NFS mount add in fstab _netdev instead of default | firewall-cmd --list-all