← 返回命令列表

Linux command

lstr 命令

文件

复制后可按需替换文件名、目录或参数。

常用示例

Display directory tree

lstr

Display tree for a specific path

lstr [path/to/directory]

Launch interactive TUI mode

lstr interactive

Show tree with Git status

lstr -G -g

Show sizes, permissions and icons

lstr -s -p --icons

Limit recursion depth

lstr -L [2]

Sort by size, directories first

lstr --sort size --dirs-first

说明

lstr is a fast, minimalist directory tree viewer written in Rust. It scans directories in parallel and brings modern features to the classic tree command: `.gitignore` support, Git status indicators, Nerd Font icons, clickable hyperlinks, and multiple sort modes. The interactive subcommand launches a keyboard-driven TUI (built with ratatui) for browsing the tree. Non-interactive output is designed to pipe cleanly into tools like fzf.

参数

-a, --all
List all files and directories, including hidden ones.
-d, --dirs-only
Show directories only.
-g, --gitignore
Respect `.gitignore` and other standard ignore files.
-G, --git-status
Show Git status indicators for files and directories.
--icons
Display file-specific icons (requires a Nerd Font).
--hyperlinks
Render paths as clickable hyperlinks in supported terminals.
-L, --level _DEPTH_
Limit the depth of the tree.
-p, --permissions
Show file permissions (Unix-like systems).
-s, --size
Show file sizes.
--sort _TYPE_
Sort by name, size, modified, or extension.
--dirs-first
List directories before files.
--case-sensitive
Use case-sensitive sorting.
--natural-sort
Use version-aware ("natural") sort ordering.
-r, --reverse
Reverse the sort order.
--dotfiles-first
Sort hidden files and folders first.
--color _WHEN_
Colorize output (always, auto, never).
--expand-level _LEVEL_
Initial expansion depth (interactive mode only).

FAQ

What is the lstr command used for?

lstr is a fast, minimalist directory tree viewer written in Rust. It scans directories in parallel and brings modern features to the classic tree command: `.gitignore` support, Git status indicators, Nerd Font icons, clickable hyperlinks, and multiple sort modes. The interactive subcommand launches a keyboard-driven TUI (built with ratatui) for browsing the tree. Non-interactive output is designed to pipe cleanly into tools like fzf.

How do I run a basic lstr example?

Run `lstr` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -a, --all do in lstr?

List all files and directories, including hidden ones.