In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
The editor will share with you a case of using find command under linux. I hope you will gain a lot after reading this article. Let's discuss it together.
How to use the find command under linux: [# find. -name "* .c"], which lists all files under the current directory and its subdirectories with the extension name c. The find command is used to find files in the specified directory.
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.
Grammar
Find path-option [- print] [- exec-ok command] {}\
Parameter description:
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
For example:
List all files with the extension name c in the current directory and its subdirectories.
# find. -name "* .c"
List all general files in its subdirectories of the current directory
# find. -type f
List all files that have been updated in the last 20 days under the current directory and its subdirectories
# find. -ctime-20
Look for ordinary files in the / var/log directory that were changed before 7 days and ask them before deleting them:
# find / var/log-type f-mtime + 7-ok rm {}\; after reading this article, I believe you have some understanding of the cases of using find commands under linux. If you want to know more about it, welcome to follow the industry information channel. Thank you for reading!
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.