The basic syntax is as follows:
find /dir/to/search/ -name ".*" -print
find /dir/to/search/ -name ".*" -ls
search only hidden files:
find /dir/to/search/ -type f -iname ".*" -ls
search only hidden directories:
find /dir/to/search/ -type d -iname ".*" -ls
find /dir/to/search -path '*/.*' -print
find /dir/to/search -path '*/.*' -ls
In this example, search $HOME for all hidden files and dirs:
find $HOME -name ".*" -ls
135237 4 -rw-r--r-- 1 root root 18 May 20 2009 /root/.bash_logout
137605 4 -rw------- 1 root root 32 May 15 01:08 /root/.mysql_history
135240 4 -rw-r--r-- 1 root root 100 Sep 22 2004 /root/.cshrc
131153 4 drwxr----- 3 root root 4096 Feb 27 19:28 /root/.pki
136444 4 -rw-r--r-- 1 root root 686 Feb 27 07:22 /root/.bash_profile
137510 4 drwx------ 2 root root 4096 May 8 02:00 /root/.ssh
135241 4 -rw-r--r-- 1 root root 129 Dec 3 2004 /root/.tcshrc
136494 4 -rw-r--r-- 1 root root 310 Feb 27 07:22 /root/.bashrc
137490 16 -rw------- 1 root root 14970 May 15 01:02 /root/.bash_history
Ref: http://www.cyberciti.biz/faq/unix-linux-centos-ubuntu-find-hidden-files-recursively/
No comments:
Post a Comment