How To Display Folder Only in Bash Using ls command?
Today I give you three ways to display folder only in bash using ls command. Here’s the demonstration:
Step 1:
Using echo
saggi@saggi-A6200:~/Desktop$ echo */
Metasploit And Backtrack Videos/ password crack/ saggifoldear/ Untitled Folder
Step 2:
Using ls only.
saggi@saggi-A6200:~/Desktop$ ls -d */
Metasploit And Backtrack Videos/ saggifoldear/
password crack/ Untitled Folder/
Step 3:
Using ls and grep .
saggi@saggi-A6200:~/Desktop$ ls -l | grep “^d”
drwx—— 9 saggi saggi 4096 Mar 15 22:48 Metasploit And Backtrack Videos
drwx—— 2 saggi saggi 4096 Mar 17 16:33 password crack
drwxrwxr-x 2 saggi saggi 4096 Apr 8 21:58 saggifoldear
drwxrwxr-x 2 saggi saggi 4096 Mar 22 23:57 Untitled Folder