LinuxCommandLibrary

fselect

Find files with SQL-like queries

TLDR

Select full path and size from temporary or configuration files in a given directory

$ fselect size, path from [path/to/directory] where name = '[*.cfg]' or name = '[*.tmp]'
copy

Find square images
$ fselect path from [path/to/directory] where width = height
copy

Find old-school rap 320kbps MP3 files
$ fselect path from [path/to/directory] where genre = [Rap] and bitrate = [320] and mp3_year lt [2000]
copy

Select only the first 5 results and output as JSON
$ fselect size, path from [path/to/directory] limit [5] into json
copy

Use SQL aggregate functions to calculate minimum, maximum, and average size of files in a directory
$ fselect "[MIN(size), MAX(size), AVG(size), SUM(size), COUNT(*)] from [path/to/directory]"
copy

SYNOPSIS

fselect [OPTIONS] [<query>] [<path>...]
fselect [OPTIONS] --stdin [<query>]

PARAMETERS

-h, --help
    Print help information

-V, --version
    Print version information

-c, --case-sensitive
    Case sensitive matching

-i, --case-insensitive
    Case insensitive matching (default)

-f, --fixed-strings
    Literal string matching (no fuzzy)

-l, --limit <LIMIT>
    Maximum results (default: 30)

-m, --multi
    Enable multi-selection with <Tab>

-d, --depth <DEPTH>
    Maximum recursion depth (default: unlimited)

-e, --extensions <EXTENSIONS>
    Comma-separated extensions to include (e.g., rs,toml)

-s, --sort-by <FIELD>
    Sort by name|path|ext|size|mtime (default: score)

-t, --tiebreak <FIELD>
    Tiebreaker: score|index|len (default: score)

--json
    Output selected items as JSON

--csv
    Output as CSV

--tsv
    Output as tab-separated

--null
    Null-delimited output

--color <WHEN>
    Color mode: always|never|auto

--ansi
    Force ANSI colors

--no-ansi
    Disable ANSI colors (default)

--with-nth <NTH>
    Display Nth parts of lines

--with <CMD>
    Execute command on selected items

--expect <KEYS>
    Key bindings for actions (e.g., ctrl-t)

--stdin
    Read search list from stdin

DESCRIPTION

fselect is a high-performance, Rust-based command-line tool for interactive fuzzy searching and selecting files, directories, or lines from stdin. Similar to fzf, it enables rapid filtering of large lists using incremental fuzzy queries, with syntax highlighting, sorting, and multi-selection support.

It scans specified paths (default: current directory) or reads piped input, matches items based on a query, and displays ranked results in a terminal UI. Navigation uses arrow keys or vi-style motions; selection via <Enter>. Features include case-sensitive/insensitive modes, fixed-string matching, recursion depth limits, file extension filters, result limits, tiebreakers (score, index, length), and sorting by name, path, extension, size, or modification time.

Output options cover JSON, CSV, TSV, null-delimited formats for scripting. Additional capabilities: ANSI colors, nth-column filtering, post-selection command execution (--with), and key expectation (--expect) for shell integrations like fuzzy finders in editors or shells. Ideal for file pickers, log tailing, or command history selection.

Compiled binaries available; outperforms some alternatives on large datasets due to Rust efficiency. Open-source under AGPL-3.0.

CAVEATS

High memory usage on millions of files; no hidden file toggle (use .gitignore); terminal resizing may require restart.
Building requires Rust nightly for some features.

EXAMPLES

fselect '*.rs' . --multi
fd . | fselect query --json
git ls-files | fselect --expect=ctrl-t > selected.txt

INPUT MODES

Without paths: scans CWD. Stdin via pipe or --stdin. No query: lists all interactively.

EXIT CODES

0: selection made; 1: no selection or error; 130: interrupted (<Ctrl-C>)

HISTORY

Created by Anton Shafarenko (yaahc) in 2020 as a Rust fzf alternative for better performance. Initial release v0.1.0; current v0.9+ with ongoing GitHub development. Gained popularity in Rust ecosystems for scripting and IDE integrations.

SEE ALSO

fzf(1), fd(1), find(1), skim(1), ripgrep(1)

Copied to clipboard