Skip to main content
1 of 8
Mohammad
  • 738
  • 5
  • 19

To list only hidden files:

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

To list only hidden directories:

ls -ap | grep "/$" 

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.

Mohammad
  • 738
  • 5
  • 19