In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to find files and file contents in batches in the linux system", the content in the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "how to find files and file contents in batches in the linux system"!
For example, find a keyword in all the php files under the current directory
The code is as follows:
Find. /-name "* .php" | xargs grep 'keyword'
If the content you need to find contains special symbols, such as $, etc., grep needs to add parameters
The code is as follows:
Find. /-name "* .php" | xargs grep-F 'keyword'
File name lookup
File name lookup method:
For example, if we know that a file contains the letters srm, it is possible to find all the files in the system that contain these three letters. Enter:
The code is as follows:
Find / etc-name'* srm*'
This command indicates that the linux system will search the entire / etc directory for all files containing the three letters srm, such as absrmyz,tibc.srm and other eligible files can be displayed. If you also know that the file starts with the letters srm, we can also omit the first asterisk, as follows:
The code is as follows:
Find / etc-name 'srm*'
Some other references
Find-name april* looks for files starting with april in the current directory
Find-name april* fprint file looks for files starting with april in the current directory and outputs the results to file
Find-name ap*-o-name may* finds files that start with ap or may
Find / mnt-name tom.txt-ftype vfat looks for files with the name tom.txt and file system type vfat under / mnt
Find / mnt-name t.txt!-ftype vfat looks for files with the name tom.txt and file system type not vfat under / mnt
Find / tmp-name wa*-type l looks under / tmp for files whose name begins with wa and whose type is symbolic link
Find / home-mtime-2 check files that have been changed in the last two days under / home
Find / home-atime-1 check files that have been accessed within 1 day
Find / home-mmin + 60 check files that were changed 60 minutes ago under / home
Find / home-amin + 30 check files that have been accessed in the last 30 minutes
Thank you for your reading, the above is the content of "how to find files and file contents in batches in the linux system". After the study of this article, I believe you have a deeper understanding of how to find files and file contents in batches in the linux system. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.