1.先用find命令查找,再用‘| xargs rm -f ’进行删除,如果有目录用‘-rf’ ## 配合 "| xargs .."
2.同上,用‘-exec rm -f {} \; ’有目录用‘-rf’ ## -exec .. {} \; 传递语法
3.find命令,查看一分钟内修改过的文件:
find . -cmin -1 ##或写作 find . -mmin -1
4.其他
## 根据类型查看
-type c
File is of type c:
b block (buffered) special
c character (unbuffered) special
d directory
p named pipe (FIFO)
f regular file
l symbolic link; this is never true if the -L option or the -follow option is in effect,
unless the symbolic link is broken. If you want to search for symbolic links when -L is in
effect, use -xtype.
s socket
D door (Solaris)
## 设置检索结果的最大目录层级数和最小目录层级数
-maxdepth levels
Descend at most levels (a non-negative integer) levels of directories below the command line argu-
ments. -maxdepth 0
means only apply the tests and actions to the command line arguments.
-mindepth levels
Do not apply any tests or actions at levels less than levels (a non-negative integer). -mindepth 1
means process all files except the command line arguments.
## 数字参数的作用
Numeric arguments can be specified as
+n for greater than n,
-n for less than n,
n for exactly n. ## 确切地
## 根据修改时间进行查询
-ctime n
File’s status was last changed n*24 hours ago. See the comments for -atime to understand how
rounding affects the interpretation of file status change times.
-ctime n
File’s status was last changed n*24 hours ago. See the comments for -atime to understand how
rounding affects the interpretation of file status change times.
-empty
File is empty and is either a regular file or a directory.
-mmin n
File’s data was last modified n minutes ago.
-mtime n
File’s data was last modified n*24 hours ago. See the comments for -atime to understand how round-
ing affects the interpretation of file modification times.
-size n[cwbkMG]
File uses n units of space. The following suffixes can be used: ## suffixes 后缀
‘b’ for 512-byte blocks (this is the default if no suffix is used)
‘c’ for bytes
‘w’ for two-byte words
‘k’ for Kilobytes (units of 1024 bytes)
‘M’ for Megabytes (units of 1048576 bytes)
‘G’ for Gigabytes (units of 1073741824 bytes)
The size does not count indirect blocks, but it does count blocks in sparse files that are not
actually allocated. Bear in mind that the ‘%k’ and ‘%b’ format specifiers of -printf handle sparse
files differently. The ‘b’ suffix always denotes 512-byte blocks and never 1 Kilobyte blocks,
which is different to the behaviour of -ls.