To further your learning of bash
...
elfenlied's original command would fail if there are file names with spaces in them. Direct use of
stat as suggested by Reuti would address this, but if you wanted to use a
for loop this will do it - note the
in * and the quotes around
$i in the stat command:
Code:
for i in *; do echo "$i `stat -c %U "$i"`"; done
Another solution would be to use
find.
Code:
find . -type f -printf "%u %f\n"
This is not as good a solution to your specific requirement, but a very good thing to learn!