环境
Ubuntu 版本信息:
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04 LTS
Release: 22.04
Codename: jammy
安装 tree 工具
安装 tree 工具(第 1 行):
$ sudo apt-get install tree
[sudo] password for mk: ******
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
tree
0 upgraded, 1 newly installed, 0 to remove and 26 not upgraded.
Need to get 47.9 kB of archives.
After this operation, 116 kB of additional disk space will be used.
Get:1 http://cn.archive.ubuntu.com/ubuntu jammy/universe amd64 tree amd64 2.0.2-1 [47.9 kB]
Fetched 47.9 kB in 2s (27.2 kB/s)
Selecting previously unselected package tree.
(Reading database ... 196767 files and directories currently installed.)
Preparing to unpack .../tree_2.0.2-1_amd64.deb ...
Unpacking tree (2.0.2-1) ...
Setting up tree (2.0.2-1) ...
Processing triggers for man-db (2.10.2-1) ...
使用 tree 工具
在终端中使用 tree 命令列出当前目录下的文件夹和文件(第 3 行):
$ pwd
/home/mk/Documents/Vue.js/hello-world/src
$ tree
.
├── App.vue
├── assets
│ └── logo.png
├── components
│ └── HelloWorld.vue
├── main.js
├── router
│ └── index.js
└── views
├── AboutView.vue
└── HomeView.vue
4 directories, 7 files
携带 -d 选项,只列出文件夹(第 1 行):
$ tree -d
.
├── assets
├── components
├── router
└── views
4 directories
最后,用 VS Code 打开对应目录,参照一下:
参考
Ubuntu 安装tree
|