The input is the area at the bottom of the focused panel, in which you can type a filter or a command.
Its parts are
- a filtering pattern
- a verb invocation, starting with a space or a colon (
Both parts are optional.
The filtering pattern
A search pattern is made of 1 to 3 parts separated by the
/ character but you rarely need the two
The syntax is globally
The mode is either nothing (fuzzy path), just a slash (regex name) or some letters followed by a slash.
The search mode combines
- the search type: fuzzy, regex, exact, tokens
- the search object: file name, file path, file content
|mode||example query||example match||explanation|
||search for "abc" in a fuzzy way in sub-paths from current tree root|
||search for "abc" in a fuzzy way in filenames|
||search for the "ab" and "cd" tokens, in whatever order (case and diacritics insensitive)|
||search for the string "Bac" in filenames|
||search for the regular expression
||find files whose name ends in
||search for the regular expression
||search for "te/d" in sub-paths from current tree root|
||search for the
||search for the "ab" and "cd" tokens in sub-paths from current tree root|
||search for the "mask" string in file contents|
||search with a regular expression in file contents -
||search a word with a regular expression in file contents|
It's also possible to redefine those mode mappings.
Combining filtering patterns
Patterns can be combined with the
& (and) and
| (or) operators, and parentheses if necessary.
You can for example list files whose name contains a
z and whose content contains one too with
To display non
json files containing either
The last closing characters are often unecessary when no ambiguity is possible, so you could have typed this:
Why escaping ?
Look at this input:
It's for searching files whose name contains either a
a or a
b, then removing the selected one.
The pattern here is
a|b, it's a composite pattern.
A space or a colon starts the verb invocation.
So if you needs one of them in your pattern, you need to escape it with
- to search for a file whose name contains a x and a colon, you type
- to search for a file whose name contains a space just before a digit, you can use a regular expression:
The characters you use as operators and the parenthesis can be useful in patterns too, either because you want to search for them in fuzzy patterns or in file contents, or because you write non trivial regular expressions.
If you want to search for the
| character (or a
)), you can't just type it because it's used to combine elementary patterns. I needs escaping. So if you need to search for the
| character in file names, you type
An elementary pattern which starts with a
/ can only be ended with a
/, a space, or a colon.
That's why you don't have to escape other characters you want to include in your elementary pattern.
This lets you type this regular expression with no unecessary escaping:
Regular expression escaping rules still apply, so if you want to search with a regex for a file containing a
(, you'll type
The escaping character is the antislash
Most often, you don't need to know more: when broot tells you it doesn't understand your pattern, it should click that your special character needs escaping and you prefix it with a
- After the first
/of a pattern, only
\need escaping too.
- When there's no ambiguity, ending characters are often unecessary
broot interprets the left operand before the right one and doesn't interpret the second one if it's not necessary.
So if you want to search your whole disk for json files containing
abcd, it will be faster to use
/\.json$/&c/abcd rather than
c/abcd/&/\.json$/ which would look at the file name only after having scanned the content.
The verb invocation
The verb invocation is
where arguments can be empty, depending on the verb's behaviour and invocation pattern.
Verbs are detailed in the Verbs & Commands chapter.
Fuzzy Path search
Regular expression based search
Search followed by a command without arguments
re rm (which is equivalent to
This is very natural: You use the search to select your element and you don't need to remove it before typing the command.
Search followed by a command taking an argument
re mv ../regex.rs
Full text search
In this case with an escaped space:
Regular expression based full text search
Search by name/extension and content
Here's searching files whose name ends in "toml" and containing "crokey":
In practice, you won't usually bother with the
\.. And if you want to cover
"TOML" too, you'll add a
Complex composite search
Here we search for
"carg" both in file names and file contents, and we exclude
/ at the end of
c/carg/ is necessary to tell broot that the following parenthesis isn't part of the pattern.