Fix the following command so that it does search the home directory for files names README.md

71 Views Asked by At

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 ~
  1. find ~ -type f -name README.md (the answer I gave but it's wrong, why?)
  2. find ~ -name README.md (my professor's answer which is correct, how?)
1

There are 1 best solutions below

0
PromptCloud On BEST ANSWER

Both answers are correct. However, your answer is more appropriate if the question specifically asks to find regular files.

  1. The first command: find ~ -type f -name README.md specifically searches for regular files (not directories or other types of files) named "README.md" in the home directory.

  2. The second command: find ~ -name README.md searches for any file or directory named "README.md" in the home directory, including regular files, directories, symbolic links, etc.