To complement The New Idiot's good answer , I want to point out that this is:
ls -l | grep ^d
Shows all directories in the current directory . This is because ls -l appends d to the beginning of directory information.
The ls -l format is as follows:
-rwxr-xr-x 1 user group 0 Jun 12 12:25 exec_file -rw-rw-r-- 1 user group 0 Jun 12 12:25 normal_file drwxr-xr-x 16 user group 4096 May 24 12:46 dir ^ |___ see the "d"
To make this clearer, you can ls -lF :
-rwxr-xr-x 1 user group 0 Jun 12 12:25 exec_file* -rw-rw-r-- 1 user group 0 Jun 12 12:25 normal_file drwxr-xr-x 16 user group 4096 May 24 12:46 dir/
So ls -l | grep /$ ls -l | grep /$ will do the same as ls -l | grep ^d ls -l | grep ^d .
source share