1.-name参数,例:查询/root目录下以mysql开头的文件
[root@zabbix ~]# find /root/ -name "mysql*"
/root/mysql-5.7.28-1.el7.x86_64.rpm-bundle.tar
/root/mysql-community-embedded-5.7.28-1.el7.x86_64.rpm
/root/mysql-community-libs-compat-5.7.28-1.el7.x86_64.rpm
/root/mysql-community-devel-5.7.28-1.el7.x86_64.rpm
/root/mysql-community-embedded-compat-5.7.28-1.el7.x86_64.rpm
/root/mysql-community-libs-5.7.28-1.el7.x86_64.rpm
/root/mysql-community-test-5.7.28-1.el7.x86_64.rpm
/root/mysql-community-common-5.7.28-1.el7.x86_64.rpm
/root/mysql-community-embedded-devel-5.7.28-1.el7.x86_64.rpm
/root/mysql-community-client-5.7.28-1.el7.x86_64.rpm
/root/mysql-community-server-5.7.28-1.el7.x86_64.rpm
2.-name和-exec联合使用,例:查询/root目录下以mysql开头的文件并只显示文件名
-exec后面的参数是查询完对查询目标所执行的命令,这里执行的是basename命令
[root@zabbix ~]# find /root/ -name "mysql*" -exec basename {} \;
mysql-5.7.28-1.el7.x86_64.rpm-bundle.tar
mysql-community-embedded-5.7.28-1.el7.x86_64.rpm
mysql-community-libs-compat-5.7.28-1.el7.x86_64.rpm
mysql-community-devel-5.7.28-1.el7.x86_64.rpm
mysql-community-embedded-compat-5.7.28-1.el7.x86_64.rpm
mysql-community-libs-5.7.28-1.el7.x86_64.rpm
mysql-community-test-5.7.28-1.el7.x86_64.rpm
mysql-community-common-5.7.28-1.el7.x86_64.rpm
mysql-community-embedded-devel-5.7.28-1.el7.x86_64.rpm
mysql-community-client-5.7.28-1.el7.x86_64.rpm
mysql-community-server-5.7.28-1.el7.x86_64.rpm
3.-name和-user联合使用,例:查询/root目录下以mysql开头并且所属用户是root的文件
[root@zabbix ~]# ll /root/
total 1190612
-rw-------. 1 root root 1259 Jan 13 2021 anaconda-ks.cfg
-rw-r--r--. 1 root root 609556480 Jun 1 00:46 mysql-5.7.28-1.el7.x86_64.rpm-bundle.tar
-rw-r--r--. 1 7155 31415 45109364 Sep 30 2019 mysql-community-client-5.7.28-1.el7.x86_64.rpm
-rw-r--r--. 1 7155 31415 318768 Sep 30 2019 mysql-community-common-5.7.28-1.el7.x86_64.rpm
-rw-r--r--. 1 7155 31415 7037096 Sep 30 2019 mysql-community-devel-5.7.28-1.el7.x86_64.rpm
-rw-r--r--. 1 7155 31415 49329100 Sep 30 2019 mysql-community-embedded-5.7.28-1.el7.x86_64.rpm
-rw-r--r--. 1 7155 31415 23354908 Sep 30 2019 mysql-community-embedded-compat-5.7.28-1.el7.x86_64.rpm
-rw-r--r--. 1 7155 31415 136837816 Sep 30 2019 mysql-community-embedded-devel-5.7.28-1.el7.x86_64.rpm
-rw-r--r--. 1 7155 31415 4374364 Sep 30 2019 mysql-community-libs-5.7.28-1.el7.x86_64.rpm
-rw-r--r--. 1 7155 31415 1353312 Sep 30 2019 mysql-community-libs-compat-5.7.28-1.el7.x86_64.rpm
-rw-r--r--. 1 7155 31415 208694824 Sep 30 2019 mysql-community-server-5.7.28-1.el7.x86_64.rpm
-rw-r--r--. 1 7155 31415 133129992 Sep 30 2019 mysql-community-test-5.7.28-1.el7.x86_64.rpm
-rwxr-xr-x 1 root root 65334 Aug 24 16:08 speedtest-cli
[root@zabbix ~]# find /root/ -name "mysql*" -user root
/root/mysql-5.7.28-1.el7.x86_64.rpm-bundle.tar