Q. How do I display only hidden (dot) file names under Linux / UNIX operating systems?
A. If you would like to see only hidden file in the current directory, use ls command.
Bash list only hidden files
Use ls -a command to display all hidden dot files. -a option do not hide entries starting with .
$ ls -a
Output:
gimp.txt .viminfo .gnome vivek-feed.xml .gnome2 .vlc .gnome2_private .vmware .gnome-desktop .wine .gnome_private Woh Lamhe - 2006-MP3-VBR-128Kbps go.html .Xauthority
As you see output includes all files including hidden dot files. To just display dot files use command:
$ ls -a | egrep '^\.'
$ ls -A | egrep '^\.'
You can create an alias and put into .bash_profile or .bashrc file
$ vi .bash_profile
Append following line
alias lh='ls -a | egrep "^\."'
Save and close the file. Now you can use lh command (read as alias) to display only hidden (dot) files:
$ lh
- Email FAQ to a friend
- Printable version
- Rss Feed
- Last Updated: 10-20-08

{ 1 comment… read it below or add one }
If you use grep you will lose formatting (multi-column) and colour.
If you use “ls -Ad .*”, it will show you all hidden (dot) files and retain the formatting and colour. The “-d” argument is used to only show the top-level files and not contents of hidden directories.
Thanks for the tip, I didn’t know about the -A argument.