nb

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

nb - Command Line Note-Taking

nb - 命令行笔记管理工具

⚠️ IMPORTANT: Never edit files in nb git repos (
~/.nb/*
) by hand! Always use the
nb
CLI to ensure proper indexing and Git commits.
A command line and local web note-taking, bookmarking, and archiving tool with plain text data storage, Git-backed versioning, and wiki-style linking.
⚠️ 重要提示: 请勿手动编辑nb git仓库(
~/.nb/*
)中的文件!请始终使用
nb
CLI,以确保索引和Git提交正常进行。
这是一款命令行及本地网页版的笔记管理、书签收藏与归档工具,采用纯文本存储数据,支持Git版本控制,并具备维基式链接功能。

Quick Reference

快速参考

Notebooks

笔记本管理

bash
undefined
bash
undefined

List all notebooks

列出所有笔记本

nb notebooks
nb notebooks

Switch to a notebook

切换到指定笔记本

nb use <notebook>
nb use <notebook>

Create a new notebook

创建新笔记本

nb notebooks add <name>
nb notebooks add <name>

Show current notebook

查看当前使用的笔记本

nb notebooks current
undefined
nb notebooks current
undefined

Adding Notes

添加笔记

bash
undefined
bash
undefined

Add a note with title

添加带标题的笔记

nb add -t "Title" -c "Content here"
nb add -t "Title" -c "Content here"

Add note to specific notebook

向指定笔记本添加笔记

nb <notebook>: add -t "Title" -c "Content"
nb <notebook>: add -t "Title" -c "Content"

Add note with tags

添加带标签的笔记

nb add -t "Title" --tags tag1,tag2
nb add -t "Title" --tags tag1,tag2

Add note from file content

从文件导入笔记内容

nb add <notebook>:filename.md
undefined
nb add <notebook>:filename.md
undefined

Listing Notes

列出笔记

bash
undefined
bash
undefined

List notes in current notebook

列出当前笔记本中的笔记

nb list
nb list

List all notes (no limit)

列出所有笔记(无数量限制)

nb list -a
nb list -a

List notes in specific notebook

列出指定笔记本中的笔记

nb <notebook>: list
nb <notebook>: list

List with excerpts

列出笔记并显示摘要

nb list -e
nb list -e

List with tags shown

列出笔记并显示标签

nb list --tags
undefined
nb list --tags
undefined

Showing Notes

查看笔记

bash
undefined
bash
undefined

Show note by ID or title

通过ID或标题查看笔记

nb show <id> nb show "<title>"
nb show <id> nb show "<title>"

Show note from specific notebook

查看指定笔记本中的笔记

nb show <notebook>:<id>
nb show <notebook>:<id>

Print content (for piping)

打印笔记内容(用于管道操作)

nb show <id> --print
undefined
nb show <id> --print
undefined

Searching Notes

搜索笔记

bash
undefined
bash
undefined

Search across all notebooks

在所有笔记本中搜索

nb search "query"
nb search "query"

Search in specific notebook

在指定笔记本中搜索

nb <notebook>: search "query"
nb <notebook>: search "query"

Search with AND/OR/NOT

使用AND/OR/NOT逻辑搜索

nb search "term1" --and "term2" nb search "term1" --or "term2" nb search "term1" --not "exclude"
nb search "term1" --and "term2" nb search "term1" --or "term2" nb search "term1" --not "exclude"

Search by tag

按标签搜索

nb search --tag "tagname"
undefined
nb search --tag "tagname"
undefined

Editing Notes

编辑笔记

bash
undefined
bash
undefined

Edit by ID

通过ID编辑笔记

nb edit <id>
nb edit <id>

Edit by title

通过标题编辑笔记

nb edit "<title>"
nb edit "<title>"

Append content

追加内容

nb edit <id> -c "New content to append"
nb edit <id> -c "New content to append"

Prepend content

前置内容

nb edit <id> -c "Content at top" --prepend
nb edit <id> -c "Content at top" --prepend

Overwrite content

覆盖内容

nb edit <id> -c "Replace all" --overwrite
undefined
nb edit <id> -c "Replace all" --overwrite
undefined

Deleting Notes

删除笔记

bash
undefined
bash
undefined

Delete by ID (will prompt)

通过ID删除笔记(会弹出确认提示)

nb delete <id>
nb delete <id>

Force delete without prompt

强制删除,不弹出确认提示

nb delete <id> -f
undefined
nb delete <id> -f
undefined

Moving/Renaming

移动/重命名

bash
undefined
bash
undefined

Move note to another notebook

将笔记移动到另一个笔记本

nb move <id> <notebook>:
nb move <id> <notebook>:

Rename a note

重命名笔记

nb move <id> new-filename.md
undefined
nb move <id> new-filename.md
undefined

Todos

待办事项

bash
undefined
bash
undefined

Add a todo

添加待办事项

nb todo add "Task title"
nb todo add "Task title"

Add todo with due date

添加带截止日期的待办事项

nb todo add "Task" --due "2026-01-15"
nb todo add "Task" --due "2026-01-15"

List open todos

列出未完成的待办事项

nb todos open
nb todos open

List closed todos

列出已完成的待办事项

nb todos closed
nb todos closed

Mark todo as done

标记待办事项为已完成

nb todo do <id>
nb todo do <id>

Mark todo as not done

标记待办事项为未完成

nb todo undo <id>
undefined
nb todo undo <id>
undefined

Bookmarks

书签

bash
undefined
bash
undefined

Add a bookmark

添加书签

nb bookmark <url>
nb bookmark <url>

Add with comment

添加带备注的书签

nb bookmark <url> -c "My comment"
nb bookmark <url> -c "My comment"

Add with tags

添加带标签的书签

nb bookmark <url> --tags reference,dev
nb bookmark <url> --tags reference,dev

List bookmarks

列出书签

nb bookmark list
nb bookmark list

Search bookmarks

搜索书签

nb bookmark search "query"
undefined
nb bookmark search "query"
undefined

Git Operations

Git操作

bash
undefined
bash
undefined

Sync with remote

与远程仓库同步

nb sync
nb sync

Create checkpoint (commit)

创建检查点(提交)

nb git checkpoint "Message"
nb git checkpoint "Message"

Check dirty status

查看未提交的更改状态

nb git dirty
nb git dirty

Run any git command

执行任意Git命令

nb git status nb git log --oneline -5
undefined
nb git status nb git log --oneline -5
undefined

Folders

文件夹

bash
undefined
bash
undefined

Add folder to notebook

向笔记本添加文件夹

nb folders add <folder-name>
nb folders add <folder-name>

List folders

列出文件夹

nb folders
nb folders

Add note to folder

向文件夹添加笔记

nb add <folder>/<filename>.md
undefined
nb add <folder>/<filename>.md
undefined

Common Patterns

常用操作模式

Adding Note with Full Content

添加完整内容的笔记

For longer notes, create a temp file and import:
bash
undefined
对于较长的笔记,可先创建临时文件再导入:
bash
undefined

Write content to temp file first, then copy to nb

先将内容写入临时文件,再复制到nb

cp /tmp/note.md ~/.nb/<notebook>/ cd ~/.nb/<notebook> && git add . && git commit -m "Add note" nb <notebook>: index rebuild
undefined
cp /tmp/note.md ~/.nb/<notebook>/ cd ~/.nb/<notebook> && git add . && git commit -m "Add note" nb <notebook>: index rebuild
undefined

Searching Across All

全局搜索

bash
undefined
bash
undefined

Search everything

搜索所有内容

nb search "term" --all
nb search "term" --all

Search by type

按类型搜索

nb search "term" --type bookmark nb search "term" --type todo
undefined
nb search "term" --type bookmark nb search "term" --type todo
undefined

Data Location

数据存储位置

Notes are stored in
~/.nb/<notebook>/
as markdown files with Git versioning.
~/.nb/
├── notebook-name-1/ # Your first notebook
├── notebook-name-2/ # Your second notebook
└── ...
笔记以Markdown文件形式存储在
~/.nb/<notebook>/
目录下,并通过Git进行版本控制。
~/.nb/
├── notebook-name-1/ # 你的第一个笔记本
├── notebook-name-2/ # 你的第二个笔记本
└── ...

Tips

小贴士

  1. Use
    nb <notebook>:
    prefix to work with specific notebooks
  2. IDs are numbers shown in
    nb list
  3. Titles can be used instead of IDs (quoted if spaces)
  4. All changes are automatically Git-committed
  5. Use
    nb sync
    to push/pull from remote repos
  1. 使用
    nb <notebook>:
    前缀操作指定笔记本
  2. ID是
    nb list
    命令中显示的数字
  3. 可使用标题替代ID(含空格时需加引号)
  4. 所有更改会自动提交到Git
  5. 使用
    nb sync
    与远程仓库进行推送/拉取操作