What Nushell Does
- Structured pipelines — data flows as tables, not text
- Built-in data formats — JSON, CSV, YAML, TOML, XML, SQLite, Parquet
- Type system — strings, ints, floats, booleans, dates, durations, file sizes
- ls / ps / sys — system commands return structured data
- HTTP client —
http get/postwith auto-parsing - SQL-like queries — where, select, group-by, sort-by, math
- Custom commands —
defwith typed parameters - Modules — organize code into modules
- Plugins — extend via compiled plugins
- Completions — context-aware tab completion
Architecture
Rust binary. Parser produces an AST, engine evaluates pipelines. Each command produces a PipelineData value (table, record, string, etc.). Plugins communicate via JSON-RPC.
Comparison
| Shell | Data Model | Language | Cross-platform |
|---|---|---|---|
| Nushell | Structured tables | Own | Yes |
| Bash/Zsh | Text streams | POSIX sh | Unix |
| Fish | Text streams | Own | Unix |
| PowerShell | .NET objects | Own | Yes |
| Xonsh | Python objects | Python | Yes |
常见问题 FAQ
Q: 能替代 bash 吗?
A: 交互式使用可以。但 POSIX shell 脚本不兼容——现有 .sh 脚本还得用 bash 跑。Nushell 适合新脚本和日常交互。
Q: 和 PowerShell 像? A: 理念相似(结构化数据管道)但实现不同。Nushell 更轻量、跨平台原生、类型系统更简洁。
Q: 性能? A: Rust 实现,启动快、管道处理快。大文件处理比 awk/sed 稍慢但可读性好 100 倍。
来源与致谢 Sources
- Docs: https://www.nushell.sh/book
- GitHub: https://github.com/nushell/nushell
- License: MIT