Find command controlling output

Changing the output information
If you want more than just the names of the files displayed, find's -printf action lets you have just about any type of information displayed. Looking at the man page there is a startling array of options.</p>

These are used the most:
%p   filename, including name(s) of directory the file is in
%m   permissions of file, displayed in octal.
%f   displays the filename, no directory names are included
%g   name of the group the file belongs to.
%h   display name of directory file is in, filename isn't included.
%u   username of the owner of the file

As an example:

find  .  -type d  -printf "%p\t%m\n"

will print the file name along with permissions

comments powered by Disqus