Shell學習——列出當前路徑下所有目錄


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 ~]#


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM