A powerful and user-friendly search toolkit that makes finding files and content effortless. Say goodbye to complex find
and grep
commands!
- π Dual Search Modes: Find files by name OR search content within files
- π Recursive Search: Search through entire directory trees (with option to disable)
- π― Smart Filtering: Case-insensitive, exact match, and file type filtering
- π¨ Beautiful Output: Colorized results with clear indicators and line numbers
- π Easy Installation: One-command global installation
- π§ Cross-Platform: Works on Linux, macOS, Windows (WSL), and anywhere Python runs
- β‘ Multiple Interfaces: Bash and Python versions with identical functionality
# Clone or download the repository
git clone https://github.com/LinuxCTRL/smart-search-tools.git
cd smart-search-tools
# Run the installer
chmod +x install.sh
./install.sh
The installer will:
- Install scripts to
~/.local/bin
- Add the directory to your PATH
- Create convenient aliases (
ssearch
,pysearch
,smart-search
)
# Find files by name
ssearch "config" /path/to/search
# Search for content in files
ssearch -c "function main" ./src
# Search both filenames and content
ssearch -a "test" .
smart_search.sh [OPTIONS] SEARCH_TERM [PATH]
# or
python3 smart_search.py [OPTIONS] SEARCH_TERM [PATH]
Option | Long Form | Description |
---|---|---|
-c |
--content |
Search for text content within files |
-a |
--all |
Search both filenames and content |
-r |
--recursive |
Search recursively (default) |
-nr |
--no-recursive |
Search only in specified directory |
-i |
--ignore-case |
Case-insensitive search |
-e |
--exact |
Exact match search |
-t TYPE |
--type TYPE |
Filter by file type (e.g., py, txt, js) |
-h |
--help |
Show help message |
smart_search.sh
- Full bash versionsmart_search.py
- Full Python versionssearch
- Short alias for bash versionpysearch
- Short alias for Python versionsmart-search
- Alternative alias for bash version
# Find all files with "config" in the name
ssearch "config"
# Find exact config.json files
ssearch -e "config.json"
# Find config files case-insensitively
ssearch -i "CONFIG" /etc
# Find all Python files containing "class"
pysearch -c -t py "class" ./project
# Find TODO comments (case-insensitive)
ssearch -i -c "todo" .
# Find both files named "test" and content containing "test"
ssearch -a "test" ./src
# Search for exact function names
pysearch -c -e "def main" ./scripts
# Find markdown files with "installation" content
ssearch -c -t md "installation" ./docs
# Search for API references
pysearch -c "API" ./documentation
# Find all README files
ssearch "README"
# Find error messages in log files
pysearch -c -t log "error" /var/log
# Find all log files in current directory only
ssearch --no-recursive -t log "*" .
# Case-insensitive search for warnings
ssearch -i -c "warning" ./logs
- π File indicators: Different icons for files and directories
- π¨ Color coding:
- π΅ Blue for search info and directories
- π’ Green for successful matches and files
- π‘ Yellow for line numbers and search terms
- π΄ Red for highlighted matches and errors
- π£ Purple for configuration display
- π· Cyan for file paths
- π Line numbers: Precise location of content matches
- π Match highlighting: Search terms highlighted in results
- π Search summary: Clear configuration display before search
If you prefer not to use the installer:
# Copy scripts to a directory in your PATH
cp smart_search.sh ~/.local/bin/
cp smart_search.py ~/.local/bin/
chmod +x ~/.local/bin/smart_search.*
# Add ~/.local/bin to PATH if not already there
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
- Bash version: Any POSIX-compliant shell (bash, zsh, etc.)
- Python version: Python 3.6 or higher
- System: Linux, macOS, Windows (WSL), or any Unix-like system
./install.sh --uninstall
The -t
option accepts file extensions without the dot:
ssearch -t py "class" # Search .py files
ssearch -t "js,ts" "function" # Search .js and .ts files (Python version)
pysearch -c -t md "TODO" # Search .md files for content
# Case-insensitive exact match in Python files
ssearch -i -e -t py "main" ./src
# Non-recursive content search with type filter
pysearch --no-recursive -c -t txt "password" ./config
# Search both names and content, case-insensitive
ssearch -a -i "test" ./project
- Use file type filters (
-t
) for faster searches in large codebases - Limit recursion (
--no-recursive
) when searching specific directories - Use exact match (
-e
) when you know the precise term - Combine with system tools:
ssearch "*.log" /var | head -10
Contributions are welcome! Here are some ways you can help:
- π Report bugs or issues
- π‘ Suggest new features
- π Improve documentation
- π§ Submit pull requests
git clone https://github.com/LinuxCTRL/smart-search-tools.git
cd smart-search-tools
# Test the scripts
./smart_search.sh -h
python3 smart_search.py -h
This project is licensed under the MIT License - see the LICENSE file for details.
- Inspired by the need for simpler file and content searching
- Built to replace complex
find
andgrep
command combinations - Designed with user experience and readability in mind
If you encounter any issues or have questions:
- Check the Issues page
- Create a new issue with detailed information
- Include your operating system and shell information
Happy searching! πβ¨
Made with β€οΈ for developers who love efficient tools