bfs
Breadth-first file search
TLDR
SYNOPSIS
bfs [options] [path...] [expression]
DESCRIPTION
bfs is a breadth-first variant of the Unix find command. It traverses directories in breadth-first order rather than depth-first, which can be faster for certain operations and more intuitive when printing results.The tool is compatible with GNU find but uses a different traversal strategy.
PARAMETERS
-name pattern
Match filename pattern-type type
File type (f, d, l, etc.)-size n
File size-mtime n
Modification time-exec command ;
Execute command-delete
Delete matched files-depth
Process directory contents before directory-maxdepth n
Maximum depth to descend
DIFFERENCES FROM FIND
- Breadth-first traversal order- Generally faster for -quit operations- More intuitive output ordering- Compatible command-line syntax
WORKFLOW
bfs /home -name "*.pdf"
# Find large files in top levels first
bfs / -size +100M
# Delete empty directories
bfs /tmp -type d -empty -delete
# Find recently modified
bfs /var/log -mtime -1
CAVEATS
Less widely available than find. Different traversal order may affect some operations. Not installed by default on most systems. For complex queries, behavior differences possible.
HISTORY
bfs was created by Tavian Barnes in 2015 as an optimized, breadth-first alternative to the traditional find command.
