Linux finds all files with a character in the folder


The Linux grep command is used to find strings that match the conditions in the file. The grep instruction is used to find a file whose content contains the specified template style. If the content of a file is found to conform to the specified template style, the default grep instruction will display the column containing the template style. If no file name is specified, or if the given file name is – the grep instruction reads data from the standard input device.

Standard format:

grep -r string ./


grep -r message ./

Example explanation: recursively find the file containing the string message in the current directory

More about:

-R is recursive search

-N is the display line number

-R find all files including subdirectories

-I ignore case

—Xargs with grep search

find -type f -name '*.php'|xargs grep 'message'

Knowledge point expansion:

Linux looks up whether all files in the directory contain a string


-R is recursive search

-N is the display line number

*: indicates all files in the current directory, or a file name.


The above is all the files with a certain character in the Linux search folder introduced by Xiaobian to you. I hope it will help you. If you have any questions, please leave me a message and Xiaobian will reply to you in time. Thank you very much for your support of the developepaer website!
If you think this article is helpful to you, welcome to reprint, please indicate the source, thank you!

Recommended Today

Configure Apache to support PHP in the Apache main configuration file httpd.conf Include custom profile in

In Apache’s main configuration file / conf/ http.conf Add at the bottom Include “D:workspace_phpapache-php.conf” The file path can be any In D: workspace_ Create under PHP file apache- php.conf file Its specific content is [html] view plain copy PHP-Module setup LoadFile “D:/xampp/php/php5ts.dll” LoadModule php5_module “D:/xampp/php/php5apache2_2.dll” <FilesMatch “.php$”> SetHandler application/x-httpd-php </FilesMatch> <FilesMatch “.phps$”> SetHandler application/x-httpd-php-source </FilesMatch> […]