Unix、Linux、Mac、Windows、Ubuntu 上是否有列出文件/目录结构的工具?

non*_*ity 3 mac unix file-management ls ubuntu

我想知道是否有一个工具可以列出文件/目录(即对文件夹和文件结构进行快照),如下所示:

audio
  mp3
    song1.mp3
    some other song.mp3
  audio books
    7 habits.mp3
video
  samples
    up.mov
    cars.mov
Run Code Online (Sandbox Code Playgroud)

换句话说,在树结构中。

Unix 命令ls -Rls -lR可以做类似的事情,除了它不会以树结构缩进列出

Jam*_*s T 12

在 Windows 和 Linux 中,都有一个名为 tree 的命令。

在 Windows 中,tree命令 (或tree /A /F) 创建如下内容:

????plugins
?   ????dbcopy
?   ?   ????util
?   ????mssql
?   ?   ????gui
?   ????oracle
?   ?   ????gui
?   ????refactoring
?   ?   ????gui
?   ????sqlscript
?       ????prefs
????test
Run Code Online (Sandbox Code Playgroud)

在 Ubuntu 10.04 中,你必须安装 tree sudo apt-get install tree

在linux中它看起来像这样(tree -a /

|   |       |-- graphics
|   |       |   `-- fbcon
|   |       |       |-- cursor_blink
|   |       |       |-- power
|   |       |       |   `-- wakeup
|   |       |       |-- rotate
|   |       |       |-- rotate_all
|   |       |       |-- subsystem -> ../../../../class/graphics
|   |       |       `-- uevent
Run Code Online (Sandbox Code Playgroud)

这些只是树的小片段。

对于 Mac,如果您需要相同的功能,您可以tree按照此 SuperUser.SE 答案中的说明安装该命令。