GATE | Gate IT 2005 | Question 18

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?

 
(A) ls passwd
(B) cat passwd
(C) grep name passwd
(D) grep print passwd


Answer: (C)

Explanation:
Find is a Unix (or Linux) command used for searching the files in a directory hierarchy. The syntax of find command is :

find –name “filename” –print

Grep is a unix command which can be used to find file names with a watching string. The syntax of grep command is :

grep name “filename”

 
Thus, option (C) is correct.

 
Please comment below if you find anything wrong in the above post.


Quiz of this Question

My Personal Notes arrow_drop_up
Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.