The shell command find -name passwd -print is executed in /etc directory of a…

2005

The shell command

find -name passwd -print

is 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?  

  1. A.

    ls passwd

  2. B.

    cat passwd

  3. C.

    grep name passwd

  4. 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.

Explore the full course: Gate Guidance By Sanchit Sir