I would like to view the unique owners of all the files and directories underneath a certain directory.I have tried:ls -ltR <dir-path> | grep -P '^[d|\-]' | awk '{print $3}' | sort | uniqWhich commits the cardinal sin of trying to parse ls output, but works -- until I try it on a directory with an immense amount of files within a complex directory structure where it bogs down and hangs.While I could work around and simply do the command at lower levels and work up piece by piece, I was wondering if there is a more efficient way to do this in one fell swoop?
Efficient search of unique owners of files and directories
files;ls;recursive
Here's a slightly shorter version that uses find:find <path> -printf %u\n | sort -uDepending on the complexity of the directory structure, this may or may not be more efficient.