Shell – Find differences of ownerships between two home folders

file-comparisonfilespermissionsshell

I have two home folders: /home/masi and /home/masi_backup and I would like to find the differences between files of the two directories.
Pseudocode

vimdiff <`ls -la /home/masi` <`ls -la /home/masi_backup` 

How can you compare the differences of ownerships between the two directories?

Best Answer

Something like this:

vimdiff <(find /home/masi -printf "%P %u:%g %m\n" | sort) <(find /home/masi_backup -printf "%P %u:%g %m\n" | sort)

(this gives names without the leading /home/masi or /home/masi_backup, owning user and group, and permissions — the latter weren't mentioned in the question but seem useful, drop %m if you don't want them).

Related Question