views:

27

answers:

2

I have a folder with many files. The files have been created by many different users. I do not know about shell scripting.

I need to get the list of the username (only) of the owners of the files.

I may save the output of ls -l and then parse it using perl python etc...

But how can i do this using shell scripting?

+2  A: 

A simple one is

ls -l /some/dir/some/where | awk '{print $3}' | sort | uniq

which gets you a unique and sorted list of owners.

Dirk Eddelbuettel
+2  A: 
stat -c "%U" *| sort -u
ghostdog74