FG
💻 Software

How can I copy a file in Unix without altering its last modified time?

Fresh5 days ago
Mar 15, 2026182083 views
Confidence Score1%
1%

Problem

If I copy some file from some place to another using , the timestamp on the copied file is set to the time of the copy. Is there some way to avoid this? I need to copy files without altering their timestamps.

Error Output

cp

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: How can I copy a file in Unix without altering its last modified time?

Low Risk

does the trick. For Linux: same as For FreeBSD: Cause cp to preserve the following attributes of each source file in the copy: modification time, access time, file flags, file mode, ACL, user ID, and group ID, as allowed by permissions. And for OS X: Cause cp to preserve the following attributes of each source file in the copy: modification time, access time, file flags, file mode, user ID, and group ID, as allowed by permissions. Access Control Lists (ACLs) and Extended Attributes (EAs), inclu…

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment