Searching for files on Linux using the standard find command often requires remembering arcane syntax flags like -mtime, -type, and complex -exec chains. When you need to filter files by multiple attributes—such as size thresholds, modified dates, MIME types, or even embedded EXIF and MP3 metadata—constructing nested queries becomes tedious. The fselect command Linux utility re-imagines file discovery by allowing developers and system administrators to query the filesystem using standard SQL syntax.
What Is the fselect Command in Linux?
Written in Rust, fselect treats your directory structure like a relational database table. Instead of stringing together multiple shell pipes (such as find, grep, and awk), you write standard SQL-like statements: specifying the fields you want to view with SELECT, designating search paths with FROM, filtering criteria with WHERE, and formatting results with ORDER BY and LIMIT.
How to Install fselect on Linux
Installing fselect is simple across modern distributions using binary packages, Cargo, or community repositories.
Installing on Arch Linux
On Arch Linux, install fselect directly via the official community repository:
sudo pacman -S fselect
Installing on Debian, Ubuntu, and Linux Mint
Download the latest pre-compiled binary package from GitHub and place it in your system PATH:
curl -LO https://github.com/jhspetersson/fselect/releases/latest/download/fselect-x86_64-unknown-linux-musl.tar.gz
tar -xzf fselect-*.tar.gz
sudo mv fselect /usr/local/bin/
Installing via Cargo
If you maintain a local Rust development environment, install it directly with Cargo:
cargo install fselect
Basic SQL Syntax for File Searches
The standard structure for an fselect query mirrors traditional SQL:
fselect [columns] from [path] where [conditions] [modifiers]
Finding Files by Size and Extension
To locate all PDF documents larger than 50 megabytes inside your home directory, run:
fselect path, size from ~ where ext = 'pdf' and size > 50M order by size desc
Tokei parses units intuitively, recognising k, m, g, and human date strings like today, yesterday, or 2026-10-01.
Filtering by Modification Timestamps
Find log files in /var/log updated within the past 24 hours:
fselect name, modified, size from /var/log where modified >= yesterday and ext = 'log'
Available Metadata Columns
One of fselect‘s greatest strengths is the breadth of columns available to query beyond basic file names:
- Standard Metadata:
name,path,size,mode(permissions),uid,gid,user,group,created,accessed,modified. - File Characteristics:
is_file,is_dir,is_symlink,is_hidden,is_empty,is_readonly. - Hashes:
sha256,sha512,md5. - Media & Audio:
width,height,duration,title,artist,album,year,bitrate. - EXIF Photography Data:
camera_make,camera_model,iso,focal_length,aperture.
Advanced Filtering Examples
You can construct sophisticated administrative pipelines that would normally require Python or complex Bash scripts:
Finding Empty Directories
Locate all empty folders within a project directory:
fselect path from ./projects where is_dir = true and is_empty = true
Searching Inside Compressed Archives
fselect can inspect files residing directly inside .zip, .tar, or .gz archives without extracting them first. Specify the archive protocol:
fselect name, size from archive.zip where size > 1M
Filtering High-Resolution Photographs
Search your photo library for wide landscape images taken at high ISO settings:
fselect path, width, height, iso from ~/Pictures where width >= 3840 and iso > 800
Formatting Outputs for Scripts and JSON
By default, fselect formats results as a clean list or table. To pipe output into web applications or automated processing pipelines, change the output format modifier:
# Output as JSON array
fselect path, size, sha256 from /bin where is_file = true limit 10 into json
# Output as CSV with headers
fselect name, size, modified from /var/www into csv