Linux command
nu 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Start Nushell
nu
Execute command
nu -c "[command]"
Run script
nu [script.nu]
List files as table
ls | where size > 1mb
Parse JSON
open [file.json] | get [field]
说明
nu is Nushell, a cross-platform shell that treats every command's output as structured data (tables, records, lists) flowing through a pipeline. Built-ins parse common formats (JSON, YAML, TOML, CSV, SQLite, ODS, XLSX, XML, NDJSON) into the same table type, so commands such as `where`, `sort-by`, `select`, `group-by`, and `histogram` work uniformly across data sources. Pipelines pass typed values rather than byte streams, which makes data wrangling expressive but means traditional Unix pipes mixing arbitrary byte streams behave differently — wrap external commands with `^cmd` to get raw stdout, or use `into binary` / `into string` for explicit conversions.
参数
- -c, --commands _COMMAND_
- Run the given Nushell command string and exit.
- --config _FILE_
- Load _FILE_ instead of the default `config.nu`.
- --env-config _FILE_
- Load _FILE_ as the environment-setup config (`env.nu`).
- --login, -l
- Start as a login shell (sources `login.nu`).
- --interactive, -i
- Force interactive mode even when stdin is not a TTY.
- --no-config-file, -n
- Skip loading any config files.
- --no-std-lib
- Skip loading the bundled standard library.
- --stdin
- Read script from stdin.
- --table-mode, -m _MODE_
- Set the table rendering mode (e.g. rounded, heavy, light, compact, none).
- --log-level _LEVEL_
- Set the log level (trace, debug, info, warn, error).
- --ide-check _N_
- IDE-friendly syntax check of the input.
- -h, --help
- Display help information.
- -v, --version
- Display version.
FAQ
What is the nu command used for?
nu is Nushell, a cross-platform shell that treats every command's output as structured data (tables, records, lists) flowing through a pipeline. Built-ins parse common formats (JSON, YAML, TOML, CSV, SQLite, ODS, XLSX, XML, NDJSON) into the same table type, so commands such as `where`, `sort-by`, `select`, `group-by`, and `histogram` work uniformly across data sources. Pipelines pass typed values rather than byte streams, which makes data wrangling expressive but means traditional Unix pipes mixing arbitrary byte streams behave differently — wrap external commands with `^cmd` to get raw stdout, or use `into binary` / `into string` for explicit conversions.
How do I run a basic nu example?
Run `nu` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -c, --commands _COMMAND_ do in nu?
Run the given Nushell command string and exit.