To list only **hidden files**: 

 ls -ap | grep -v / | grep -e "^\." 

To list only **hidden directories**: 

 ls -ap | grep -e "^\..*/$"
 
 





 - `ls -ap` lists everything in the current directory, including hidden
 ones, and puts a `/` at the end of directories.
 - `grep -v` inverts match, so that no directory is included.
 - `"^\..*/$"` matcheseverything that start with `.` and end in `/`.