Linux clone or copy or replicate file permissions, using another file as reference

Fig.01: Linux clone or copy or replicate file permissions, using another file as reference

Fig.01: Linux clone or copy or replicate file permissions, using another file as reference

The chmod command syntax is as follows:
chmod --reference=reference-file dest-file
And chown command syntax:
chown --reference=reference-file dest-file

Examples

To copy file permissions from one file called file1.txt to another file called file2.txt, enter:
## copy file mode bits ##
chmod --reference=file1.txt file2.txt
## copy user:group ownership ##
chown --reference=file1.txt file2.txt

This syntax only works with GNU/Linux chmod and chown commands.

Examples and usage: How to copy permissions from one file to another on Linux