萬盛學電腦網

您现在的位置: 萬盛學電腦網 >> 作業系統 >  >> macOS 教學

Mac 終端機 mdfind 指令:命令列極速啟動 Spotlight 搜尋

mdfind 是 Spotlight 的命令列介面,能在終端機以極快速度搜尋檔案、中繼資料、內容,適合腳本自動化或鍵盤流操作。

mdfind 執行範例

常用範例

# 依檔名搜尋 (不區分大小寫)
mdfind -name homebrew

# 依內容搜尋關鍵字
mdfind "專案計畫書"

# 限定資料夾搜尋
mdfind -onlyin ~/Documents "會議紀錄"

# 顯示即時更新計數 (適合腳本監控)
mdfind -live "幫助文件"

查看完整手冊

man mdfind

mdfind 直接讀取 Spotlight 索引,速度遠快於 find 遍歷檔案系統。善用它能在終端機瞬間定位任何檔案。

copyright © 萬盛學電腦網 all rights reserved