Hi, I'm trying to find a file with the name "hibernate.cfg.xml" with the command find
and it can't find it, but I know it exists and in several projects under my home The command I'm executing is:
$ find /home/santi hibernate.cfg.xml
What would be the correct way to search for it?
You can try to use for example:
find /home/santi -iname hibernate.cfg.xml
-iname
iname will ignore the case sensitive, you can use it in case you know the name of the file but don't remember if it was case sensitive: for example if the file washiBerNate.cfg.xml
, orhibernate.cfg.xml
using this option it would find it regardless of case or lowercase.find /home/santi -iname hibernate.cfg.xml
either
-name
name will only find the file, if it is exactly the same as the one indicated, for example: if the file werehiBerNate.cfg.xml
, using this option it will NOT find said file because it takes into account upper or lower case letters.find /home/santi -name hibernate.cfg.xml
For more options you can look at these links:
This question has several answers, which anyway, if it is not the same as your question, it may be useful at some point:
Find all files containing a text string in Linux
To search all subdirectories use
/
To search in a specific folder, for example
home/santi
:If you wanted to search from the current directory inwards, and suppose you wanted to extend the search to all files starting with "hibernate" you could do:
Find function arguments :
If the type of file to search for is not specified, it might also print a folder named hibernate.cfg.xml in the result list .