码迷,mamicode.com
首页 > 系统相关 > 详细

linux 之 查找目录下有那些目录的方法

时间:2018-05-06 22:20:59      阅读:149      评论:0      收藏:0      [点我收藏+]

标签:目录下查找目录

查找目录下有那些目录的方法
内容:
[root@localhost kang]# ll
total 16
-rw-r--r-- 1 root root    0 May  6 21:21 d.txt
drwxr-xr-x 2 root root 4096 May  6 21:14 kang
-rw-r--r-- 1 root root    0 May  5 18:55 kang.txt
drwxr-xr-x 2 root root 4096 May  5 23:40 nginx
-rw-r--r-- 1 root root    5 May  5 23:40 test.sh
-rw-r--r-- 1 root root   38 May  5 23:27 test.txt

方法一:通常方法
ls -l | grep ‘^d‘       #正则表达式^...以什么为开头 ,如^d.以d开头

方法二:为目录加标识
[root@localhost kang]# ls -F
d.txt  kang/  kang.txt  nginx/  test.sh  test.txt
[root@localhost kang]# ls -F | grep ‘/$‘      #以...结尾,如/$ 意思是以/结尾。
kang/
nginx/

方法三:find命令
[root@localhost kang]# find . -type d !  -name .
./nginx
./kang

linux 之 查找目录下有那些目录的方法

标签:目录下查找目录

原文地址:http://blog.51cto.com/12965094/2113331

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!