Linux command
jless 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
View a JSON file
jless [file.json]
View JSON from stdin
cat [file.json] | jless
View YAML file
jless --yaml [file.yaml]
Start with data mode
jless -m data [file.json]
Start with line mode
jless -m line [file.json]
Truncate long strings
jless --truncate [file.json]
Open in scrolloff mode
jless --scrolloff [5] [file.json]
说明
jless is a command-line JSON viewer with vim-like navigation. It provides syntax highlighting, collapsible nodes, and search functionality for exploring JSON and YAML data. Two viewing modes exist: data mode presents a tree view with collapsible objects and arrays, while line mode shows raw formatted output. Switch between them or start with -m. Navigation follows vim conventions. Use h/j/k/l for movement, Space to toggle node expansion, and c/e for bulk collapse/expand. Search with / and navigate results with n/N. The yank command copies values at the current position to the clipboard, useful for extracting specific data from large structures. jless handles large files efficiently through lazy parsing and rendering, making it suitable for multi-megabyte JSON files.
参数
- -m, --mode _mode_
- Initial viewing mode: data or line.
- --yaml
- Parse input as YAML instead of JSON.
- --json
- Parse input as JSON (default).
- --truncate
- Truncate long strings in display.
- --scrolloff _lines_
- Minimum lines above/below cursor.
- -n, --line-numbers
- Show line numbers.
- -N, --no-line-numbers
- Hide line numbers.
- -h, --help
- Display help information.
- -V, --version
- Display version information.
FAQ
What is the jless command used for?
jless is a command-line JSON viewer with vim-like navigation. It provides syntax highlighting, collapsible nodes, and search functionality for exploring JSON and YAML data. Two viewing modes exist: data mode presents a tree view with collapsible objects and arrays, while line mode shows raw formatted output. Switch between them or start with -m. Navigation follows vim conventions. Use h/j/k/l for movement, Space to toggle node expansion, and c/e for bulk collapse/expand. Search with / and navigate results with n/N. The yank command copies values at the current position to the clipboard, useful for extracting specific data from large structures. jless handles large files efficiently through lazy parsing and rendering, making it suitable for multi-megabyte JSON files.
How do I run a basic jless example?
Run `jless [file.json]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -m, --mode _mode_ do in jless?
Initial viewing mode: data or line.