Skip to content

A powerful and user-friendly search toolkit that makes finding files and content effortless. Say goodbye to complex find and grep commands!

Notifications You must be signed in to change notification settings

LinuxCTRL/smart-find

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ” Smart Search Tools

License: MIT Shell Python

A powerful and user-friendly search toolkit that makes finding files and content effortless. Say goodbye to complex find and grep commands!

✨ Features

  • πŸ” 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

πŸš€ Quick Start

Installation

# 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)

Basic Usage

# 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" .

πŸ“– Detailed Usage

Command Syntax

smart_search.sh [OPTIONS] SEARCH_TERM [PATH]
# or
python3 smart_search.py [OPTIONS] SEARCH_TERM [PATH]

Options

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

Available Commands After Installation

  • smart_search.sh - Full bash version
  • smart_search.py - Full Python version
  • ssearch - Short alias for bash version
  • pysearch - Short alias for Python version
  • smart-search - Alternative alias for bash version

πŸ’‘ Examples

Finding Configuration Files

# 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

Searching Code

# 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

Searching Documentation

# 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"

Log Analysis

# 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

🎨 Output Features

  • πŸ“„ 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

πŸ› οΈ Installation Details

Manual Installation

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

Requirements

  • 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

Uninstallation

./install.sh --uninstall

πŸ”§ Advanced Usage

File Type Filtering

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

Combining Options

# 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

Performance Tips

  1. Use file type filters (-t) for faster searches in large codebases
  2. Limit recursion (--no-recursive) when searching specific directories
  3. Use exact match (-e) when you know the precise term
  4. Combine with system tools: ssearch "*.log" /var | head -10

🀝 Contributing

Contributions are welcome! Here are some ways you can help:

  • πŸ› Report bugs or issues
  • πŸ’‘ Suggest new features
  • πŸ“– Improve documentation
  • πŸ”§ Submit pull requests

Development Setup

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

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • Inspired by the need for simpler file and content searching
  • Built to replace complex find and grep command combinations
  • Designed with user experience and readability in mind

πŸ“ž Support

If you encounter any issues or have questions:

  1. Check the Issues page
  2. Create a new issue with detailed information
  3. Include your operating system and shell information

Happy searching! πŸ”βœ¨

Made with ❀️ for developers who love efficient tools

About

A powerful and user-friendly search toolkit that makes finding files and content effortless. Say goodbye to complex find and grep commands!

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published