You need to use the find command to list all hidden files recursively on a Linux or Unix like systems.
Syntax: Recursively list all hidden files and directories on Linux/Unix
The basic syntax is as follows:
find /dir/to/search/ -name ".*" -print
OR
find /dir/to/search/ -name ".*" -ls
OR search only hidden files:
find /dir/to/search/ -type f -iname ".*" -ls
OR search only hidden directories:
find /dir/to/search/ -type d -iname ".*" -ls
OR
find /dir/to/search -path '*/.*' -print
find /dir/to/search -path '*/.*' -ls
find /dir/to/search -path '*/.*' -ls
In this example, search $HOME for all hidden files and dirs:
find $HOME -name ".*" -ls
Sample outputs:
6553607 4 -rw-r--r-- 1 admi admi 100 Sep 22 2004 ./.cshrc 6553664 4 -rw------- 1 admi admi 1024 Nov 17 04:40 ./.rnd 6553604 4 -rw-r--r-- 1 admi admi 18 May 20 2009 ./.bash_logout 6553665 4 drwx------ 2 admi admi 4096 Dec 18 2012 ./.gnupg 6553671 0 -rw------- 1 admi admi 0 Dec 18 2012 ./.gnupg/secring.gpg 6553669 0 -rw------- 1 admi admi 0 Dec 18 2012 ./.gnupg/pubring.gpg~ 6553673 4 -rw------- 1 admi admi 899 Dec 18 2012 ./.gnupg/pubring.gpg 6553667 8 -rw------- 1 admi admi 7856 Dec 18 2012 ./.gnupg/gpg.conf 6553668 4 -rw------- 1 admi admi 1200 Dec 18 2012 ./.gnupg/trustdb.gpg 6553602 20 -rw------- 1 admi admi 17462 Apr 7 10:55 ./.bash_history 6553610 4 drwx------ 3 admi admi 4096 Jan 16 2013 ./.config 6553660 4 drwx------ 2 admi admi 4096 Jan 16 2013 ./.config/htop 6553681 4 -rw-r--r-- 1 admi admi 597 Apr 11 2013 ./.config/htop/htoprc 6553723 12 -rw------- 1 admi admi 9629 Mar 30 23:56 ./.viminfo 6553615 4 drwxr-xr-x 3 admi admi 4096 Nov 29 2012 ./.original-configs
To save the results to a file called foo.txt, use a redirection as follows:
find $HOME/projects/ -name ".*" -ls > foo.txt cat foo.txt
See find(1) command man page for more information.
0 comments:
Post a Comment