I am confused on these two answers I got. Question:
Fix the following command so that it does search the home directory for files named
README.md:find README.md ~
find ~ -type f -name README.md(the answer I gave but it's wrong, why?)find ~ -name README.md(my professor's answer which is correct, how?)
Both answers are correct. However, your answer is more appropriate if the question specifically asks to find regular files.
The first command:
find ~ -type f -name README.mdspecifically searches for regular files (not directories or other types of files) named "README.md" in the home directory.The second command:
find ~ -name README.mdsearches for any file or directory named "README.md" in the home directory, including regular files, directories, symbolic links, etc.