How-to-simply...

Append yyyyMMdd-HHmmss datetime to the filename on Linux

  • 1 "filename-$(date +'%Y%m%d-%H%M%S').txt"
  • N %Y four digits year
    %m zero-padded month
    %d zero-padded day
    %H zero-padded 24-hour
    %M zero-padded minute
    %S zero-padded second

References