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
Featured Articles:
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- My 10 UNIX Command Line Mistakes
- Linux: 20 Iptables Examples For New SysAdmins

- 25 PHP Security Best Practices For Sys Admins
- The Novice Guide To Buying A Linux Laptop
- 10 Greatest Open Source Software Of 2009
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- Top 20 OpenSSH Server Best Security Practices
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Linux Video Editor Software
Facebook it - Tweet it - Print it -


{ 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.