Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/xwmx/nb/llms.txt

Use this file to discover all available pages before exploring further.

nb search performs full-text search across notes, bookmarks, and any other text files tracked in a notebook. It is powered by Git’s built-in git grep tool by default and supports boolean query logic, regular expressions, tag and type filters, and a choice of alternative search backends. Results show matching excerpts with the matched text highlighted.

Usage

nb search ([<notebook>:][<folder-path>/][<id> | <filename> | <title>])
          <query>... [-a | --all] [--and <query>] [--not <query>] [--or <query>]
          [-l | --list] [--path] [-t <tag1>,<tag2>... | --tag <tag1>,<tag2>...]
          [-t | --tags] [--type <type> | --<type>] [--utility <name>]

Options

<query>
string
One or more search terms. When multiple positional query arguments are given, they are combined as AND queries — only items matching all of the terms are returned.
-a, --all
flag
Search all unarchived notebooks rather than only the current one.
--and <query>
string
Add an explicit AND condition. Equivalent to passing an additional positional query. Items must match this term in addition to any other queries.
--or <query>
string
Add an OR condition. Items matching any one of the OR queries are included. Multiple --or flags can be chained in a single command.
--not <query>
string
Exclude items that match this term from the results, regardless of other query matches.
-l, --list
flag
Print only the id, filename, and title for each matching item — no excerpts. Useful for feeding results into other commands.
--path
flag
Print the full filesystem path for each matching file instead of the default listing format.
-t, --tag <tag1>,<tag2>...
string
Filter results to items that contain the specified tag(s). Accepts a comma-separated list. Multiple -t / --tag flags are combined as AND conditions.
--tags
flag
List all tags found in the current notebook (or the specified notebook/folder) instead of performing a text search.
--type <type>
string
Restrict the search to items of a particular type. <type> can be a file extension (md, org, txt, etc.) or one of the named types: archive, audio, book, bookmark, document, folder, image, note, text, video. The shorthand --<type> form (e.g., --bookmark) is also accepted.
--utility <name>
string
Use an alternative search tool instead of git grep. Supported values: rga, rg, ag, ack, grep.

Shortcut Alias

nb q <query>

Examples

# Search the current notebook for "example query"
nb search "example query"

# Search using the shortcut alias
nb q "example query"

# Search a specific notebook
nb search example: "example query"

# Search a specific folder within a notebook
nb search example:notes/ "project plan"

Search Backends

By default nb search uses git grep, which is always available because every notebook is a git repository. For additional capabilities — such as searching inside PDFs or binary files — you can install and select an alternative tool:
BackendFlag valueHomepage
git grep (default)(built-in)Always available
rga (ripgrep-all)--utility rgahttps://github.com/phiresky/ripgrep-all
rg (ripgrep)--utility rghttps://github.com/BurntSushi/ripgrep
ag (Silver Searcher)--utility aghttps://github.com/ggreer/the_silver_searcher
ack--utility ackhttps://beyondgrep.com/
grep--utility grephttps://en.wikipedia.org/wiki/Grep
rga (ripgrep-all) can search inside PDFs, Word documents, EPUBs, and other binary formats in addition to plain text, making it the most powerful option when your notebook contains mixed file types.

How Multiple Query Terms Work

Multiple positional arguments behave as AND: nb search "foo" "bar" returns only items that contain both “foo” and “bar”. The --and, --or, and --not flags give you explicit control over how terms are combined, and all four mechanisms can be mixed in a single command.
# Matches items that contain "Alpha" AND "Beta" but NOT "Gamma"
nb search "Alpha" --and "Beta" --not "Gamma"

# Matches items that contain "Alpha" OR "Delta"
nb search "Alpha" --or "Delta"

Searching Tags

Tags in nb are written as #hashtag inside note content. The --tag / -t option searches for these inline tags:
# Find all notes tagged #project
nb search --tag project

# Find notes tagged both #project and #2024
nb search --tag project,2024

# List every tag used across the current notebook
nb search --tags

Build docs developers (and LLMs) love