This is a very simple solution using the tree
command in the directory you want to search for. -f
shows the full file path and |
is used to pipe the output of tree to grep
to find the file containing the string filename
in the name.
tree -f | grep filename
use ack its simple.
just type ack <string to be searched>
A correct answer has already been supplied, but for you to learn how to help yourself I thought I'd throw in something helpful in a different way; if you can sum up what you're trying to achieve in one word, there's a mighty fine help feature on Linux.
man -k <your search term>
What that does is to list all commands that have your search term in the short description. There's usually a pretty good chance that you will find what you're after. ;)
That output can sometimes be somewhat overwhelming, and I'd recommend narrowing it down to the executables, rather than all available man-pages, like so:
man -k find | egrep '\(1\)'
or, if you also want to look for commands that require higher privilege levels, like this:
man -k find | egrep '\([18]\)'
The find
command will take long time because it scans real files in file system.
The quickest way is using locate
command, which will give result immediately:
locate "John"
If the command is not found, you need to install mlocate
package and run updatedb
command first to prepare the search database for the first time.
More detail here: https://medium.com/@thucnc/the-fastest-way-to-find-files-by-filename-mlocate-locate-commands-55bf40b297ab
Source: Stackoverflow.com