Home > Blockchain >  Bash: Find a file from the root directory that has the word net
Bash: Find a file from the root directory that has the word net

Time:05-13

According to the site, excercise is: Find a file from the root directory that has the word net in it.

I did:

find /home/ -name net

And nothing happens.

And I did:

find / -name net

And I received 100s of files with name net or permission denied.

Did I fail the tak successfully?

CodePudding user response:

-name net will only find files named exactly net. You want -name '*net*'.

If the exercise is asking for the root directory, it is referring to /, not /home/. But note that there are a bunch of files under root that you don't have permission to view, which is why you saw those permission denied errors. You can suppress stderr to hide these errors with 2> /dev/null.

Putting it all together:

find / -name '*net*' 2>/dev/null
  • Related