Linux command
mlocate 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Find files by name
locate [pattern]
Case-insensitive search
locate -i [pattern]
Update database
sudo updatedb
Show only existing files
locate -e [pattern]
Limit results
locate -l [10] [pattern]
Count matches
locate -c [pattern]
说明
mlocate (merging locate) finds files by searching a pre-built database rather than scanning the filesystem. This makes searches extremely fast. The database is typically updated daily by cron, or manually with updatedb.
参数
- -i, --ignore-case
- Case-insensitive match.
- -l _n_, --limit _n_
- Limit output to n entries.
- -c, --count
- Print count only.
- -e, --existing
- Only existing files.
- -b, --basename
- Match basename only.
- -r, --regexp
- Use regex pattern.
- -d _path_
- Use specific database.
FAQ
What is the mlocate command used for?
mlocate (merging locate) finds files by searching a pre-built database rather than scanning the filesystem. This makes searches extremely fast. The database is typically updated daily by cron, or manually with updatedb.
How do I run a basic mlocate example?
Run `locate [pattern]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -i, --ignore-case do in mlocate?
Case-insensitive match.