FG

Is there some difference between mv and {cp + rm the old file} on Unix?

Fresh3 days ago
Mar 15, 202626935 views
Confidence Score0%
0%

Problem

; These are two sets of statements. Is there some difference between what they do?

Error Output

mv a b

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Is there some difference between mv and {cp + rm the old file} on Unix?

Low Risk

Assuming the files involved are on the same file system, then mv simply changes pointers in the file system, whereas cp copies the entire contents of the file, and rm once again changes pointers. So mv is far more efficient.

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment