List only hidden files with ls command
Posted on October 19th, 2008 by linux
We all know how to list non-hidden and hidden files with ls command on shell. However I could not find out how to list only hidden files ( starting with “.” ) with only ls command. One, but not complete solution could by to using TAB key. For example ls . and pressing 2xTAB will display only hidden files. It seem that we need to call for help grep command:
ls -a mydir/ | grep '^\.'
If anyone knows how to do this trick with only ls command please let me know.