Can we instruct tar to do not keep modified time of the files in archive file while compress.

What I want is, the extracted directories/files should get time from machine where it's extracting, not from the archive file. But I want to get it done in compression part, not in extraction part with -m.

  • 1
    You can use --mtime to force the stored mtimes to a specific value. I don't think there's an option to avoid storing it altogether.
    – Tom Hunt
    Commented Sep 3, 2015 at 21:27
  • tarhas no option --mtimeIf you refer to vendor specific options, you should mention which vendor specific implementation you refer to.
    – schily
    Commented Sep 4, 2015 at 12:48

1 Answer 1


tar always stores the modification time of the files it puts into the archive.

If you like to get the current time of extraction while extracting the archive, the only way to achieve this is to use

tar xm < xxx.tar

at extraction time.

  • Thanks for answer @schily. So I understand it's not possible on compression part and possible only on extraction part.
    – PJ DevOps
    Commented Sep 5, 2015 at 11:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .