I was skimming over the documentation of find to better utilize the command usage.
I was reading the part that says
GNU find will handle symbolic links in one of two ways; firstly, it can dereference the links for you - this means that if it comes across a symbolic link, it examines the file that the link points to, in order to see if it matches the criteria you have specified. Secondly, it can check the link itself in case you might be looking for the actual link. If the file that the symbolic link points to is also within the directory hierarchy you are searching with the find command, you may not see a great deal of difference between these two alternatives.
By default, find examines symbolic links themselves when it finds them (and, if it later comes across the linked-to file, it will examine that, too).
To my understanding, if I do something like:
find -L -iname "*foo*"
this will search the current directory recursively and when it encounters a symlink, it follows the link to the original file. If the original file has the name pattern
*foo*, the former link is reported.
However, this doesn't seem the case. I have
main-file sl-file -> main-file
Running the command above
find -L -iname "*main*" reports
And I was expecting
./main-file # because it matches the criterion ./sl-file # because the file points to matches the criterion
That being said, using another test like
-type works as I am expecting. Say I have this:
main-file dir/sl-file -> ../main-file
find dir -type f
returns nothing. But this
find -L dir -type f
I have gone through this post that says a file name isn't a file property. This is something I can't really get my head around.