Shell – How to set a file’s mtime in epoch format

shelltimestampstouch

I know how to get a file's mtime in epoch format:

stat --format=%Y <file>

But I have not been able to figure out how to set a file's mtime in epoch format. The touch(1) man page appears to only accept a "timestamp" value (more-or-less fixed format which uses months, days, hours, minues, etc) or a "mostly free format human readable date string".

Is there another utility I should be looking into?

Thanks.

Best Answer

At least in the GNU world:

touch --date=@1403970787 file

Like with date.

Related Question