Thanks to visit codestin.com
Credit goes to lib.rs

#multi-threading #grep

bin+lib sik

A fast and concurrent command-line tool for searching patterns in files

6 releases

Uses new Rust 2024

0.1.5 Nov 30, 2025
0.1.4 Nov 27, 2025

#1455 in Text processing

AGPL-3.0-or-later

25KB
579 lines

Sik

sik is a simple, fast, and concurrent command-line tool for searching patterns within files in a given directory. It is written in Rust and leverages multi-threading to perform searches efficiently.

Features

  • Concurrent Searching: Utilizes multiple threads to search files in parallel, making it fast on modern multi-core processors.
  • Simple and Intuitive: Easy to use with a minimal set of command-line arguments.
  • Cross-Platform: Built with Rust, it can be compiled and run on Windows, macOS, and Linux.

Dependencies

This project uses the following external crate:

  • regex: For regular expression based pattern matching.

Prerequisites

To build and run sik, you need to have the Rust programming language toolchain installed. You can install it from rust-lang.org.

Installation

  1. Clone the repository:

    git clone https://github.com/mi66mc/sik.git
    cd sik
    
  2. Build the project: For a development build, run:

    cargo build
    

    For a release build (recommended for performance), run:

    cargo build --release
    

    The executable will be located at target/release/sik.

Usage

The basic syntax for sik is:

sik [OPTIONS] <PATTERN> [PATH]

Arguments

  • <PATTERN>: The pattern to search for within the files, Regex is used to build the pattern. If the pattern contains spaces, it should be enclosed in quotes.
  • [PATH]: The directory to search in. If not provided, it defaults to the current directory (.).

Options

  • --primary, --secondary, --tertiary: Arguments you provide to choose what type of style you want to be displayed.
  • -t, --threads <NUM>: Sets the number of threads to use for searching. By default, it uses twice the number of available logical processors.
  • -h, --help: Prints the help message and exits.

Examples

  • Search for a pattern in the current directory:

    sik "my_pattern"
    
  • Search for a pattern in a specific directory:

    sik "my pattern with spaces" "/path/to/your/directory"
    
  • Search using a specific number of threads:

    sik --secondary --threads 8 "error" "./logs"
    

License

This project is licensed under the GNU Affero General Public License v3.0. See the LICENSE file for more details.

Dependencies

~2–3MB
~52K SLoC