in Operating System
2,303 views
6 votes
6 votes

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. ls passwd
  2. cat passwd
  3. grep name passwd
  4. grep print passwd
in Operating System
2.3k views

2 Answers

7 votes
7 votes
The closest answer is A. However, all of them are wrong.

the find command in this format prints the files that have the name "passwd" in the current directory and in all the subdirectories. Towards this behavior, `ls` command is the only one with a similar output, but it prints the file with the name `passwd` from the current directory only and not from its subdirectories.

Rest of the commands given are concerned with the content of the file "passwd".

2 Comments

see highlighted part

0
0

 so “ls passwd” only shows “passwd”? so is it like it is showing “passwd” only if that file is in the directory?

0
0
–1 vote
–1 vote
option C

4 Comments

option C is searching for name inside the file passwd. I dont think any option is correct.
1
1

option  c is the right answer ...... it will show the

Find Files Using Name in Current Directory

Find all the files whose name is tecmint.txt in a current working directory.

# find . -name tecmint.txt
./tecmint.txt
–1
–1
Did you try it?
0
0
no ...... but i got this from linux website .... which tell about the commands
0
0
Answer:

Related questions