我们经常需要将一个文件生成为目录结构树,我们可以通过win 提供的tree指令来搞定。
win系统里的tree指令:
在cmd种输入tree /?
C:\Users\zhang\Desktop\work>tree /?
以图形显示驱动器或路径的文件夹结构。
TREE [drive:][path] [/F] [/A]
/F 显示每个文件夹中文件的名称。
/A 使用 ASCII 字符,而不使用扩展字符。
你会发现这个win系统的tree指令太鸡肋,配置项太少了,一个目录里面要忽略点文件啥的都没法去配置。
win10是支持内置的linux子系统
1、选择开发者选项,会自动安装环境
2、勾选适用于Linux的windows子系统
3、在应用商店种下载Ubuntu并启动出现如下界面
4、在初始化安装里设置用户
Installing, this may take a few minutes...
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: zgt
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Installation successful!
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
zgt@zhang:~$ sudo apt-get update //最好先执行下update--避免出现一些不必要的错误
[sudo] password for zgt: //提供权限需要输入密码
Hit:1 http://archive.ubuntu.com/ubuntu xenial InRelease
Get:2 http://security.ubuntu.com/ubuntu xenial-security InRelease [107 kB]
Get:3 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB]
Get:4 http://archive.ubuntu.com/ubuntu xenial-backports InRelease [107 kB]

本文介绍了如何在Windows10中安装Linux子系统Ubuntu,并演示了如何利用Ubuntu中的tree指令生成文件目录结构树。虽然Windows内置的tree指令功能有限,但在Ubuntu子系统中可以使用更强大的Linux版本tree命令,该命令提供了丰富的参数,方便对目录结构进行详细展示和注释。
最低0.47元/天 解锁文章
1万+

被折叠的 条评论
为什么被折叠?



