![linux search for text in files subdirectories linux search for text in files subdirectories](https://linoxide.com/wp-content/uploads/2021/09/find-file-linux-command-line.png)
The find command by default travels down the entire directory tree recursively, which is time and resource consuming. Not doing so will seem to work sometimes and give strange results at other times. Its always better to wrap the search term (name parameter) in double or single quotes. To ignore the case, just use the "iname" option instead of the "name" option. It is often useful to ignore the case when searching for file names. However, if the directory is actually a symlink to some other location then you MUST specify the trailing slash for it to work properly (find.
![linux search for text in files subdirectories linux search for text in files subdirectories](https://phoenixnap.com/kb/wp-content/uploads/2021/04/grep-include-all-subdirectories-in-a-search.png)
When specifying the directory ("./test" in this example), its fine to omit the trailing slash. Of course you can press Ctrl + c anytime to stop the command. Trying to search the "/" directory which is the root, would search the entire file system including mounted devices and network storage devices.
![linux search for text in files subdirectories linux search for text in files subdirectories](https://www.computerhope.com/unix/images/grep-tutorial-05.jpg)
So this is a very powerful way to find all files of a given extension. Note that all sub directories are searched recursively. The following command searches for files by their name. The following command will look for files in the test directory in the current directory. The command is same as the following $ find. This command lists out all the files in the current directory as well as the subdirectories in the current directory. List all files in current and sub directories The basic syntax of the find command looks like this $ find location comparison-criteria search-term 1. The find command is an essential one to learn, if you want to get super productive with the command line on linux.
#Linux search for text in files subdirectories install#
The find command is available on most linux distros by default so you do not have to install any package.