I'm using Ubuntu server 14.04 to backup all data from '/mnt/test/ folder' to '/home/john/' with TAR and archive to stuff.tar.gz and to make it to backup automatical.

I use cron to backup it every week so what if i want to use cron to create an additional backup file instead of overwriting the existing one? So, after month I'd have 4 backups, each with a unique name. Is there a way? Script ar other backup tool what would do that?

  • 1
    Just add a time (date) stamp to the tar command. backup_date +%F.tar.gz – Panther May 28 '14 at 19:57
  • when i did this (backup_date +%F.tar.gz) i get backup_date+%F.tar.gz and no data.i'm new at linux so i think i did some error – AbsentasLT May 28 '14 at 20:40
  • Those are back ticks ` and not singel quotes '. you substitute that "backup_date +%F.tar.gz" in your tar command, where you are using "stuff.tar.gz" If you need help, post the command you actually run + any actual error message. – Panther May 28 '14 at 20:46
  • sorry for stupid question, how to type back tick? – AbsentasLT May 28 '14 at 20:59
  • On my keyboard it is on the ~ key on the upper left next to the number one. – Panther May 28 '14 at 21:00

Use a date in the name of your archive

tar -cpzf /home/john/stuff_`/bin/date +%F`.tar.gz /mnt/test
  • Add hour / minute ;) "date +%F %l:%M" – Panther May 28 '14 at 21:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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