默认在使用find时,会列出一个目录下的全部目录和文件,这样文件量是很大打,而有的时候我们仅仅想看到一个目录的目录和文件,或者是一个目录下的几级目录文件。
可以使用下面的方法:
可以使用下面的方法:
test@fileserver2:/opt$ find /opt/ -maxdepth 1
/opt/
/opt/data
/opt/zimbra
/opt/Adobe
test@fileserver2:/opt$ find /opt/ -maxdepth 2
/opt/
/opt/data
/opt/data/zdesktop
/opt/data/zd_backup
/opt/zimbra
/opt/zimbra/zdesktop
/opt/Adobe
/opt/Adobe/Reader9
test@fileserver2:/opt$ find /opt/ -maxdepth 3
/opt/
/opt/data
/opt/data/zdesktop
/opt/data/zdesktop/log
/opt/data/zdesktop/zdesktop.webapp
/opt/data/zdesktop/data
/opt/data/zdesktop/jetty
/opt/data/zdesktop/sqlite
/opt/data/zdesktop/zimlets-deployed
/opt/data/zdesktop/index
/opt/data/zdesktop/heapdump
/opt/data/zdesktop/store
/opt/data/zdesktop/bin
/opt/data/zdesktop/profile
/opt/data/zdesktop/zimlets
/opt/data/zdesktop/redolog
/opt/data/zdesktop/conf
/opt/data/zd_backup
/opt/zimbra
/opt/zimbra/zdesktop
/opt/zimbra/zdesktop/open_source_licenses.txt
/opt/zimbra/zdesktop/lib
/opt/zimbra/zdesktop/License.rtf
/opt/zimbra/zdesktop/data
/opt/zimbra/zdesktop/jetty
/opt/zimbra/zdesktop/linux
/opt/zimbra/zdesktop/db
/opt/zimbra/zdesktop/README.txt
/opt/Adobe
/opt/Adobe/Reader9
/opt/Adobe/Reader9/Reader
/opt/Adobe/Reader9/Browser
/opt/Adobe/Reader9/bin
/opt/Adobe/Reader9/Resource
test@fileserver2:/opt$
/opt/
/opt/data
/opt/zimbra
/opt/Adobe
test@fileserver2:/opt$ find /opt/ -maxdepth 2
/opt/
/opt/data
/opt/data/zdesktop
/opt/data/zd_backup
/opt/zimbra
/opt/zimbra/zdesktop
/opt/Adobe
/opt/Adobe/Reader9
test@fileserver2:/opt$ find /opt/ -maxdepth 3
/opt/
/opt/data
/opt/data/zdesktop
/opt/data/zdesktop/log
/opt/data/zdesktop/zdesktop.webapp
/opt/data/zdesktop/data
/opt/data/zdesktop/jetty
/opt/data/zdesktop/sqlite
/opt/data/zdesktop/zimlets-deployed
/opt/data/zdesktop/index
/opt/data/zdesktop/heapdump
/opt/data/zdesktop/store
/opt/data/zdesktop/bin
/opt/data/zdesktop/profile
/opt/data/zdesktop/zimlets
/opt/data/zdesktop/redolog
/opt/data/zdesktop/conf
/opt/data/zd_backup
/opt/zimbra
/opt/zimbra/zdesktop
/opt/zimbra/zdesktop/open_source_licenses.txt
/opt/zimbra/zdesktop/lib
/opt/zimbra/zdesktop/License.rtf
/opt/zimbra/zdesktop/data
/opt/zimbra/zdesktop/jetty
/opt/zimbra/zdesktop/linux
/opt/zimbra/zdesktop/db
/opt/zimbra/zdesktop/README.txt
/opt/Adobe
/opt/Adobe/Reader9
/opt/Adobe/Reader9/Reader
/opt/Adobe/Reader9/Browser
/opt/Adobe/Reader9/bin
/opt/Adobe/Reader9/Resource
test@fileserver2:/opt$
通过上面的指令和结果,大家应该能看到区别。
本文转自博客园zhyiwww 的博客,原文链接:http://www.blogjava.net/zhyiwww/,如需转载请自行联系原博主。