how to get only hidden files in UNIX?



In unix/Linux hidden files typically starts with a period  i.e. namely dot ('.')

In order to get hidden files we need to use the " -a " option with -d as well  and with regular expression ".*" .

If you want only files starts with dot (".")i.e. we have to use grep command as  grep "^-" as below.


Hidden Files and directories:

[root@www ~]# ls -lad .*
dr-xr-x---. 29 root root  4096 Apr 22 05:38 .
dr-xr-xr-x. 24 root root  4096 Apr 22 05:15 ..
-rw-------.  1 root root 15327 Apr 18 23:14 .bash_history
-rw-r--r--.  1 root root    18 May 20  2009 .bash_logout
-rw-r--r--.  1 root root   176 May 20  2009 .bash_profile
-rw-r--r--.  1 root root   176 Sep 22  2004 .bashrc
drwxr-xr-x.  2 root root  4096 Apr 18 22:04 .cache
drwxr-xr-x.  5 root root  4096 Apr 18 22:05 .config
-rw-r--r--.  1 root root   100 Sep 22  2004 .cshrc
drwx------.  3 root root  4096 Apr 18 22:04 .dbus
-rw-------.  1 root root    16 Apr 18 22:04 .esd_auth
drwx------.  4 root root  4096 Apr 18 22:05 .gconf
drwx------.  2 root root  4096 Apr 18 22:07 .gconfd
drwx------.  6 root root  4096 Apr 18 22:05 .gnome2
drwxr-xr-x.  3 root root  4096 Apr 18 22:04 .gnote
drwx------.  2 root root  4096 Apr 18 22:04 .gnupg
drwxr-xr-x.  2 root root  4096 Apr 18 22:04 .gstreamer-0.10
-rw-r--r--.  1 root root   107 Apr 18 22:04 .gtk-bookmarks
drwx------.  2 root root  4096 Apr 18 22:04 .gvfs
-rw-------.  1 root root   310 Apr 18 22:04 .ICEauthority
drwxr-xr-x.  2 root root  4096 Apr 18 22:05 .icons
drwxr-xr-x.  3 root root  4096 Apr 18 22:04 .local
drwxr-xr-x.  2 root root  4096 Apr 18 22:04 .nautilus
drwx------.  2 root root  4096 Apr 18 22:04 .pulse
-rw-------.  1 root root   256 Apr 18 22:04 .pulse-cookie
-rw-------.  1 root root   928 Apr 18 22:07 .recently-used.xbel
-rw-------.  1 root root  1024 Mar  4 18:41 .rnd
drwx------.  2 root root  4096 Feb 25 08:34 .ssh
-rw-r--r--.  1 root root   129 Dec  3  2004 .tcshrc
drwxr-xr-x.  2 root root  4096 Apr 18 22:05 .themes
drwx------.  4 root root  4096 Apr 18 22:05 .thumbnails
-rw-------.  1 root root  8284 Apr  8 18:55 .viminfo

Only Hidden Files:

[root@www ~]# ls -lad .* | grep "^-"
-rw-------.  1 root root 15327 Apr 18 23:14 .bash_history
-rw-r--r--.  1 root root    18 May 20  2009 .bash_logout
-rw-r--r--.  1 root root   176 May 20  2009 .bash_profile
-rw-r--r--.  1 root root   176 Sep 22  2004 .bashrc
-rw-r--r--.  1 root root   100 Sep 22  2004 .cshrc
-rw-------.  1 root root    16 Apr 18 22:04 .esd_auth
-rw-r--r--.  1 root root   107 Apr 18 22:04 .gtk-bookmarks
-rw-------.  1 root root   310 Apr 18 22:04 .ICEauthority
-rw-------.  1 root root   256 Apr 18 22:04 .pulse-cookie
-rw-------.  1 root root   928 Apr 18 22:07 .recently-used.xbel
-rw-------.  1 root root  1024 Mar  4 18:41 .rnd
-rw-r--r--.  1 root root   129 Dec  3  2004 .tcshrc
-rw-------.  1 root root  8284 Apr  8 18:55 .viminfo

[root@www ~]#






Comments

Popular posts from this blog

How to check the hardware information in Linux Systems?

Ansible for Devops

All About Amazon Web Services(AWS)