About Linux FAQ

Browse More FAQs:

Bash Shell: Display All Hidden Dot Files In a Directory

Posted by Vivek Gite [Last updated: October 20, 2008]

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

Capture each and every moment of life with a FREE 4 GB SD memory card with the purchase of select digital cameras from Canon, Nikon, Pentax and others from Amazon

E-mail    Print    Can't find an answer to your question? Contact us

Related Other Helpful FAQs:

Leave a Reply

We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Tags: , , , , , , , ,

Copyright © 2006-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Powered by Open source software.