searchfs: Free and Efficient File Search Tool for macOS Terminal
searchfs is a powerful command-line utility for macOS designed to efficiently search for files using the HFS+ and APFS file systems.
It is an ideal solution for users who need more control and speed than Spotlight offers.
How does it work?
searchfs
is a macOS command line tool to quickly search by filename on entire APFS and HFS+ volumes. Searching takes place at the driver level using the file system catalog. This means the volume's directory tree can be scanned much faster than with a standard recursive filename search using find
.
Search is case-insensitive by default. Matching files are printed to standard output in the order they are found in the catalog. See the man page for details.
KatSearch is a native graphical macOS application built on top of searchfs
.
Features
- Fast Searches: Utilizes the underlying filesystem for quick search operations.
- Flexible Queries: Supports complex search queries, including name, type, and metadata.
- Easy Integration: Can be easily integrated into scripts and other command-line workflows.
Installation
Manual Installation:
- Download the latest release from the GitHub repository.
- Unzip the downloaded file.
Move the searchfs
binary to /usr/local/bin
:
sudo mv searchfs /usr/local/bin
Homebrew:
brew install searchfs
How to use?
Search with Metadata:
searchfs -m "metadata_key=metadata_value" /path/to/search
Search by Type:
searchfs -k "filetype" /path/to/search
Search by Name:
searchfs -n "filename" /path/to/search
Examples
Search for Specific Filename:
searchfs -n "report.docx" /Users/username
Search for Files Modified Recently:
searchfs -m "kMDItemFSContentChangeDate >= $time.now(-7d)" /Users/username
Find All PDF Files:
searchfs -k "pdf" /Users/username/Documents
Advanced Usage
- Combine multiple search criteria for refined results.
- Use
searchfs
in scripts to automate file management tasks.
Final Note
searchfs offers a robust and efficient solution for file searching on macOS, surpassing the limitations of Spotlight with speed and flexibility. Whether you need to find files by name, type, or metadata, searchfs provides the tools to perform searches quickly and effectively.
Install it today and streamline your file search process on macOS.
For more information and detailed usage, visit the searchfs GitHub repository.
License
BSD License