1、ls -d */
[root@client02 ~]# ls -d */
Desktop/ Documents/ Downloads/ jq-1.5/ Music/ Pictures/ Public/ Templates/ Videos/ zookeeper/
[root@client02 ~]#
2、ls -F | grep /$
[root@client02 ~]# ls -F | grep '/$'
Desktop/
Documents/
Downloads/
jq-1.5/
Music/
Pictures/
Public/
Templates/
Videos/
zookeeper/
[root@client02 ~]#
-F:附加文件类别:符号在文件名最后,/表明是一个目录;@表明是符号链接;*表明是一个可执行文件。
3、ls -l|grep ^d
[root@client02 ~]# ls -l|grep ^d
drwxr-xr-x. 2 root root 6 Apr 17 2017 Desktop
drwxr-xr-x. 2 root root 6 Apr 17 2017 Documents
drwxr-xr-x. 2 root root 6 Apr 17 2017 Downloads
drwxr-xr-x. 9 1002 1002 4096 Aug 19 19:53 jq-1.5
drwxr-xr-x. 2 root root 6 Apr 17 2017 Music
drwxr-xr-x. 2 root root 6 Apr 17 2017 Pictures
drwxr-xr-x. 2 root root 6 Apr 17 2017 Public
drwxr-xr-x. 2 root root 6 Apr 17 2017 Templates
drwxr-xr-x. 2 root root 6 Apr 17 2017 Videos
drwxr-xr-x. 4 root root 29 Apr 11 20:08 zookeeper
[root@client02 ~]#
4、find . -maxdepth 1 -type d -print
[root@client02 ~]# find . -maxdepth 1 -type d -print
.
./.cache
./.dbus
./.config
./.ssh
./Desktop
./Downloads
./Templates
./Public
./Documents
./Music
./Pictures
./Videos
./.local
./.ansible
./zookeeper
./jq-1.5
./.pki
[root@client02 ~]#