1. 背景
Windows系统文件管理器自带了搜索功能,但是速度比较慢,一般我喜欢用everything进行文件查找操作。
Linux对文件查找也提供了一些命令,比较好用,接下来介绍之。
2. 按类型查找
使用find /home-type d
命令,可以查找home目录下的目录文件,d表示目录文件。
例如:
[chen@localhost ~]$ find /home/chen/test1 -type d
/home/chen/test1
/home/chen/test1/folder1
-type的参数有:
-type f
普通文件(file)-type d
目录文件(directory)-type l
链接文件(link)-type p
管道文件(pipe)-type b
块文件(block)-type c
字符文件(char)
3. 按名称查找
使用find /home -name xxx
可以查找名字包含xxx的文件。
例如:
[chen@localhost ~]$ find /home/chen -name test1
/home/chen/test1
可以精准查找某个文件。