Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a cron job for creating a gzip file:

mysqldump... | gzip -c > myfile..sql.gz

I want myfile to be of the format "time_date.sql.gz"

How do I create file with the current date and time?


share|improve this question

1 Answer 1

up vote 7 down vote accepted
myfile_`date '+%F_%T'`.sql.gz
share|improve this answer
thanks......... – Am. Feb 8 '10 at 16:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.