[root@localhost ~]# find /demo -maxdepth 1 -name "*.txt"
/demo/aaa.txt
/demo/bbb.txt
/demo/c.txt
/demo/alex.txt
/demo/sort.txt
/demo/sort1.txt
/demo/ip.txt
/demo/luffy.txt
/demo/1alex.txt
/demo/2alex.txt
/demo/3alex.txt
/demo/4alex.txt
/demo/5alex.txt
/demo/6alex.txt
/demo/7alex.txt
/demo/8alex.txt
/demo/9alex.txt
/demo/10alex.txt
[root@localhost ~]# find /demo -maxdepth 2 -name "*.txt"
/demo/aaa.txt
/demo/bbb.txt
/demo/c.txt
/demo/alex.txt
/demo/sort.txt
/demo/sort1.txt
/demo/ip.txt
/demo/luffy.txt
/demo/bbb/ddd.txt
/demo/bbb/{1...10}alex.txt
/demo/1alex.txt
/demo/2alex.txt
/demo/3alex.txt
/demo/4alex.txt
/demo/5alex.txt
/demo/6alex.txt
/demo/7alex.txt
/demo/8alex.txt
/demo/9alex.txt
/demo/10alex.txt
[root@localhost demo]# find . -name "[0-9]*"
./1alex.txt
./2alex.txt
./3alex.txt
./4alex.txt
./5alex.txt
./6alex.txt
./7alex.txt
./8alex.txt
./9alex.txt
./10alex.txt
./1mjj
./2mjj
./3mjj
./4mjj
./5mjj
./6mjj
./7mjj
./8mjj
./9mjj
./10mjj
[root@localhost demo]# find . -type f -name "[0-9]*"
./1alex.txt
./2alex.txt
./3alex.txt
./4alex.txt
./5alex.txt
./6alex.txt
./7alex.txt
./8alex.txt
./9alex.txt
./10alex.txt
[root@localhost demo]# find . -type d -name "[0-9]*"
./1mjj
./2mjj
./3mjj
./4mjj
./5mjj
./6mjj
./7mjj
./8mjj
./9mjj
./10mjj
[root@localhost demo]# find . -type f -name "[0-9]*" -delete
[root@localhost demo]# find . -type f -name "[0-9]*"
[root@localhost demo]# ls -l
total 44
drwxr-xr-x. 2 root root 6 Jan 7 21:31 10mjj
drwxr-xr-x. 2 root root 6 Jan 7 21:31 1mjj
drwxr-xr-x. 2 root root 6 Jan 7 21:31 2mjj
drwxr-xr-x. 2 root root 6 Jan 7 21:31 3mjj
drwxr-xr-x. 2 root root 6 Jan 7 21:31 4mjj
drwxr-xr-x. 2 root root 6 Jan 7 21:31 5mjj
drwxr-xr-x. 2 root root 6 Jan 7 21:31 6mjj
drwxr-xr-x. 2 root root 6 Jan 7 21:31 7mjj
drwxr-xr-x. 2 root root 6 Jan 7 21:31 8mjj
drwxr-xr-x. 2 root root 6 Jan 7 21:31 9mjj
-rw-r--r--. 1 root root 8495 Jan 6 20:52 aaa.txt
-rw-r--r--. 1 root root 54 Jan 6 21:33 alex.txt
drwxr-xr-x. 2 root root 45 Jan 7 21:29 bbb
-rw-r--r--. 1 root root 167 Jan 6 21:18 bbb.txt
-rw-r--r--. 1 root root 7 Jan 6 21:28 c.txt
-rw-r--r--. 1 root root 59 Jan 6 22:38 ip.txt
-rw-r--r--. 1 root root 123 Jan 6 22:53 luffy.txt
-rw-r--r--. 1 root root 938 Jan 6 21:57 password
-rw-r--r--. 1 root root 15 Jan 6 22:31 sort1.txt
-rw-r--r--. 1 root root 36 Jan 6 22:30 sort.txt
[root@localhost demo]# stat alex.txt
File: ‘alex.txt’
Size: 54 Blocks: 8 IO Block: 4096 regular file
Device: 803h/2051d Inode: 51354698 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Context: unconfined_u:object_r:default_t:s0
Access: 2025-01-06 21:36:45.853159948 +0800
Modify: 2025-01-06 21:33:27.454160705 +0800
Change: 2025-01-06 21:33:27.454160705 +0800
Birth: -
[root@localhost demo]# find . -atime -1
.
./password
./sort.txt
./sort1.txt
./ip.txt
./luffy.txt
./bbb
./bbb/ddd.txt
./bbb/{1...10}alex.txt
./1mjj
./2mjj
./3mjj
./4mjj
./5mjj
./6mjj
./7mjj
./8mjj
./9mjj
./10mjj
[root@localhost demo]# find . -atime 1
./.aaa.txt.swo
./aaa.txt
./bbb.txt
./c.txt
./alex.txt
[root@localhost demo]# find . -atime +1
[root@localhost demo]# find . -maxdepth 1 ! -type d
./.aaa.txt.swo
./aaa.txt
./bbb.txt
./c.txt
./alex.txt
./password
./sort.txt
./sort1.txt
./ip.txt
./luffy.txt
[root@localhost demo]# find /demo -type f -size +11k
/demo/.aaa.txt.swo
[root@localhost demo]# find /demo -maxdepth 2 -name "*.txt"
/demo/aaa.txt
/demo/bbb.txt
/demo/c.txt
/demo/alex.txt
/demo/sort.txt
/demo/sort1.txt
/demo/ip.txt
/demo/luffy.txt
/demo/bbb/ddd.txt
/demo/bbb/{1...10}alex.txt
[root@localhost demo]# find . -path "./bbb" -prune -o -name "*.txt" -print
./aaa.txt
./bbb.txt
./c.txt
./alex.txt
./sort.txt
./sort1.txt
./ip.txt
./luffy.txt
[root@localhost demo]# find . -type f -name "[0-9]*"
[root@localhost demo]# touch {1..10}apt.txt
[root@localhost demo]# ls
10apt.txt 1mjj 3apt.txt 4mjj 6apt.txt 7mjj 9apt.txt alex.txt c.txt password
10mjj 2apt.txt 3mjj 5apt.txt 6mjj 8apt.txt 9mjj bbb ip.txt sort1.txt
1apt.txt 2mjj 4apt.txt 5mjj 7apt.txt 8mjj aaa.txt bbb.txt luffy.txt sort.txt
[root@localhost demo]# find . -type f -name "[0-9]*"
./1apt.txt
./2apt.txt
./3apt.txt
./4apt.txt
./5apt.txt
./6apt.txt
./7apt.txt
./8apt.txt
./9apt.txt
./10apt.txt
[root@localhost demo]# find . -type f -name "[0-9]*" -ok rm {} \;
< rm ... ./1apt.txt > ? y
< rm ... ./2apt.txt > ? y
< rm ... ./3apt.txt > ? y
< rm ... ./4apt.txt > ? y
< rm ... ./5apt.txt > ? y
< rm ... ./6apt.txt > ? y
< rm ... ./7apt.txt > ? y
< rm ... ./8apt.txt > ? y
< rm ... ./9apt.txt > ? y
< rm ... ./10apt.txt > ? y
[root@localhost demo]# ls
10mjj 2mjj 4mjj 6mjj 8mjj aaa.txt bbb c.txt luffy.txt sort1.txt
1mjj 3mjj 5mjj 7mjj 9mjj alex.txt bbb.txt ip.txt password sort.txt