Shell Command – How to Clone Ownership and Permissions from Another File

chownfilespermissionsshell

Is there a command or flag to clone the user/group ownership and permissions on a file from another file? To make the perms and ownership exactly those of another file?

Best Answer

On GNU/Linux chown and chmod have a --reference option

chown --reference=otherfile thisfile
chmod --reference=otherfile thisfile
Related Question