How to find files excluding symbolic links? How to find files excluding symbolic links? linux linux

How to find files excluding symbolic links?


Check the man page again ;) It's:

find /path/to/files -type f

type f searches for regular files only - excluding symbolic links.


! -type l

For example, if you want to search all regular files in /usr/bin, excluding symlink:

find /usr/bin/ \! -type l


Do you want it to follow symlinks but not return them (if they match your pattern)?

find -H?

man find     ...     -H      Cause the file information and file type (see stat(2)) returned for each symbolic link specified on the command line to be those of             the file referenced by the link, not the link itself.  If the referenced file does not exist, the file information and type will be             for the link itself.  File information of all symbolic links not on the command line is that of the link itself.     -L      Cause the file information and file type (see stat(2)) returned for each symbolic link to be those of the file referenced by the             link, not the link itself.  If the referenced file does not exist, the file information and type will be for the link itself.             This option is equivalent to the deprecated -follow primary.