ClawSkills logoClawSkills

Nb

使用 nb CLI 管理笔记、书签和笔记本。在多个笔记本中创建、列出、搜索和组织笔记,并支持 Git 版本控制。

介绍

# nb - Command Line Note-Taking

> ⚠️ **重要提示:** 切勿手动编辑 nb git 仓库(`~/.nb/*`)中的文件!请始终使用 `nb` 命令行界面,以确保正确的索引和 Git 提交。

一个命令行和本地 Web 笔记、书签和归档工具,采用纯文本数据存储、Git 支持的版本控制和 Wiki 风格的链接。

## 快速参考

### 笔记本

```bash # List all notebooks nb notebooks

# Switch to a notebook nb use <notebook>

# Create a new notebook nb notebooks add <name>

# Show current notebook nb notebooks current ```

### 添加笔记

```bash # Add a note with title nb add -t "Title" -c "Content here"

# Add note to specific notebook nb <notebook>: add -t "Title" -c "Content"

# Add note with tags nb add -t "Title" --tags tag1,tag2

# Add note from file content nb add <notebook>:filename.md ```

### 列出笔记

```bash # List notes in current notebook nb list

# List all notes (no limit) nb list -a

# List notes in specific notebook nb <notebook>: list

# List with excerpts nb list -e

# List with tags shown nb list --tags ```

### 查看笔记

```bash # Show note by ID or title nb show <id> nb show "<title>"

# Show note from specific notebook nb show <notebook>:<id>

# Print content (for piping) nb show <id> --print ```

### 搜索笔记

```bash # Search across all notebooks nb search "query"

# Search in specific notebook nb <notebook>: search "query"

# Search with AND/OR/NOT nb search "term1" --and "term2" nb search "term1" --or "term2" nb search "term1" --not "exclude"

# Search by tag nb search --tag "tagname" ```

### 编辑笔记

```bash # Edit by ID nb edit <id>

# Edit by title nb edit "<title>"

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

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

# Overwrite content nb edit <id> -c "Replace all" --overwrite ```

### 删除笔记

```bash # Delete by ID (will prompt) nb delete <id>

# Force delete without prompt nb delete <id> -f ```

### 移动/重命名

```bash # Move note to another notebook nb move <id> <notebook>:

# Rename a note nb move <id> new-filename.md ```

### 待办事项

```bash # Add a todo nb todo add "Task title"

# Add todo with due date nb todo add "Task" --due "2026-01-15"

# List open todos nb todos open

# List closed todos nb todos closed

# Mark todo as done nb todo do <id>

# Mark todo as not done nb todo undo <id> ```

### 书签

```bash # Add a bookmark nb bookmark <url>

# Add with comment nb bookmark <url> -c "My comment"

# Add with tags nb bookmark <url> --tags reference,dev

# List bookmarks nb bookmark list

# Search bookmarks nb bookmark search "query" ```

### Git 操作

```bash # Sync with remote nb sync

# Create checkpoint (commit) nb git checkpoint "Message"

# Check dirty status nb git dirty

# Run any git command nb git status nb git log --oneline -5 ```

### 文件夹

```bash # Add folder to notebook nb folders add <folder-name>

# List folders nb folders

# Add note to folder nb add <folder>/<filename>.md ```

## 常用模式

### 添加包含完整内容的笔记

对于较长的笔记,请创建一个临时文件并导入:

```bash # Write content to temp file first, then copy to nb cp /tmp/note.md ~/.nb/<notebook>/ cd ~/.nb/<notebook> && git add . && git commit -m "Add note" nb <notebook>: index rebuild ```

### 全局搜索

```bash # Search everything nb search "term" --all

# Search by type nb search "term" --type bookmark nb search "term" --type todo ```

## 数据位置

笔记以带有 Git 版本控制的 Markdown 文件形式存储在 `~/.nb/<notebook>/` 中。

``` ~/.nb/ ├── notebook-name-1/ # Your first notebook ├── notebook-name-2/ # Your second notebook └── ... ```

## 提示

1. 使用 `nb <notebook>:` 前缀来操作特定的笔记本 2. ID 是 `nb list` 中显示的数字 3. 可以使用标题代替 ID(如果包含空格需加引号) 4. 所有更改都会自动进行 Git 提交 5. 使用 `nb sync` 从远程仓库推送或拉取更改

更多产品