[英]command to list all the folders and sub-folders in a directory in linux
I would like to check all the folders and sub-folders in a directory. 我想检查目录中的所有文件夹和子文件夹。
ls -R
works fine, but it lists all the files in each folder and sub-folder. ls -R
可以正常工作,但是它列出了每个文件夹和子文件夹中的所有文件。 As a result I can't see what I want to check unless ls -R |less
. 结果,除非
ls -R |less
否则我看不到要检查的内容。
ls -R | less
ls -R | less
is also not a good choice because I have thousands and thousands of files in each sub-folder. ls -R | less
是一个好选择,因为每个子文件夹中都有成千上万个文件。
Install tree
package. 安装
tree
包。 You can easily change max display depth of directory with -L
. 您可以使用
-L
轻松更改目录的最大显示深度。
For example: 例如:
$ tree -L 1 /
/
├── bin -> usr/bin
├── boot
├── dev
├── etc
├── home
├── lib -> usr/lib
├── lib64 -> usr/lib
├── lost+found
├── media
├── mnt
├── opt
├── proc
├── root
├── run
├── sbin -> usr/bin
├── srv
├── sys
├── tmp
├── usr
└── var
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.