# bfs

> Breadth-first variant of the UNIX find command with improved usability and helpful error messages

Stars: 1.3k · Categories: File Management

- Repository: https://github.com/tavianator/bfs
- Website: https://tavianator.com/projects/bfs.html
- Page: https://www.trmn.sh/tools/bfs

## Install

- Homebrew: `brew install bfs`
- APT: `apt install bfs`
- DNF: `dnf install bfs`

## Overview

bfs is a file search tool that reimplements the UNIX find command using breadth-first search instead of depth-first traversal. This approach typically finds target files faster by exploring directories level by level, avoiding deep dives into irrelevant subdirectories before finding matches in shallow locations. The tool maintains compatibility with POSIX, GNU, and BSD versions of find while adding usability improvements.

Unlike traditional find implementations, bfs accepts command-line arguments in flexible order and provides helpful error detection with typo correction suggestions. It includes static analysis to warn about potentially incorrect expressions and offers enhanced operators like -exclude for skipping entire subtrees and -nohidden for ignoring hidden files. These extensions simplify common search patterns that require complex syntax in standard find.

The tool is designed for system administrators, developers, and power users who frequently search filesystems and want faster results with better error handling. It supports the same predicates, actions, and expressions as standard find implementations, making it a drop-in replacement for existing scripts and workflows.

### Installation

```bash
# via Homebrew
brew install bfs
```

```bash
# via APT
apt install bfs
```

```bash
# via DNF
dnf install bfs
```

![bfs breadth-first search demonstration](https://media.trmn.sh/cached/6f80df03af0d63602a64e2995b15b2aa570dbf61db77d8517db3ee3b06b5954d.svg)

## Alternatives

- [xleak](https://www.trmn.sh/tools/xleak.md): Excel file viewer and interactive TUI for terminal with multi-sheet support and export capabilities (Rust, 1.5k stars)
- [fm](https://www.trmn.sh/tools/fm.md): Terminal-based file manager built with Go and Bubble Tea framework (636 stars)
- [hazelnut](https://www.trmn.sh/tools/hazelnut.md): Terminal-based automated file organizer that watches folders and applies rules to move, copy, rename, or delete files based on patterns (Rust, 327 stars)
- [deletor](https://www.trmn.sh/tools/deletor.md): File deletion tool with interactive TUI and CLI modes supporting filters, trash integration, and batch operations. (261 stars)
- [cull](https://www.trmn.sh/tools/cull.md): Interactive TUI disk space analyzer for scanning directories, finding large files, and deleting them from the terminal. (168 stars)

## Guides

- [Swap ls, cat, find and grep for eza, bat, fd and ripgrep](https://www.trmn.sh/guides/modern-unix-replacements): Install eza, bat, fd and ripgrep, learn the side-by-side commands and flag differences, and alias them without breaking your scripts.
- [Modern Replacements for find](https://www.trmn.sh/replace/find): Replace find with fd, bfs or fselect: regex search with smart defaults, a breadth-first drop-in, or SQL-like file queries.

---

Canonical: https://www.trmn.sh/tools/bfs
