In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces "how to use find in linux". In daily operation, I believe many people have doubts about how to use find in linux. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts about "how to use find in linux". Next, please follow the editor to study!
In linux, the find command is used to find files under the specified directory, and the syntax is "find specifies directory assignment rules"; when using this command without setting any parameters, the command will look for subdirectories and files under the current directory and display all the subdirectories and files found.
The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
What is the use of find in linux
The Linux find command is used to find files in the specified directory. Any string that precedes a parameter is treated as the name of the directory you are looking for. If you use this command without setting any parameters, the find command looks for subdirectories and files under the current directory. And all the subdirectories and files found are displayed.
The syntax is:
Find path-option [- print] [- exec-ok command] {}\
Among them
Find judges path and expression according to the following rules, the first-(), on the command line! The first part is path, followed by expression. The current path is used if the path is an empty string, and-print is used as the default expression if the expression is an empty string.
There are as many as 20 or 30 options available in expression, and only the most commonly used ones are introduced here.
-mount,-xdev: only check and specify files in the same file system to avoid listing files in other file systems
-amin n: read in the past n minutes
-anewer file: a file that was read later than the file file
-atime n: files that have been read in the past n days
-cmin n: modified in the past n minutes
-cnewer file: files that are newer than the file file
-ctime n: files that have been modified in the past n days
-empty: empty file-gid n or-group name: is gid n or group name name
-ipath p,-path p: files whose path names match p. Ipath ignores case.
-name name,-iname name: a file whose name matches name. Iname ignores case
-size n: the file size is n units, b represents a block of 512 bytes, c represents the number of characters, and k indicates that kilo bytes,w is two bytes.
-type c: a file of type c.
D: directory
C: font device file
B: block device file
P: named storage column
F: general documents
L: symbolic link
S: socket
-pid n: process id is the file of n
You can use () to separate expressions and use the following operations.
Exp1-and exp2
! Expr
-not expr
Exp1-or exp2
Exp1, exp2
Examples are as follows:
List all files in the current directory and its subdirectories with the suffix .c
# find. -name "* .c" at this point, the study on "how to use find in linux" is over. I hope I can solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.