The shell command find -name passwd -print is executed in /etc directory of a…
2005
The shell command
find -name passwd -printis executed in /etc directory of a computer system running Unix. Which of the following shell commands will give the same information as the above command when executed in the same directory?
- A.
ls passwd
- B.
cat passwd
- C.
grep name passwd
- D.
grep print passwd
Attempted by 32 students.
Show answer & explanation
Correct answer: A
The command 'find -name passwd -print' searches for files named 'passwd' in the current directory and prints their paths. To get the same information, you need a command that locates files by name rather than searching their content. Option 0 correctly identifies this behavior, whereas commands like 'grep' search file contents instead of file names.