We can use the Find command on Linux or Unix systems to query all (all) hidden files
Syntax: recursively find and List all (all) hidden files on Linux/unix
The basic syntax is as follows:
[Root@dabu.info ~] #find/The text/pieces/clips/-name to find ". *"-print
Explain:
1. ". *" indicates the name of the file to find. Because the hidden file and folder names for Linux/unix are "." The beginning. and * represents a wildcard that means to find all file names and folder names and start files and folders with ".".
2.-print represents the result of a print lookup. Same as-ls function
Or
[Root@dabu.info ~] #find/The text/pieces/clips/-name to find ". *"-ls
Or search for hidden files only:
[Root@dabu.info ~] #find/text/pieces/clips/-type f-iname ". *"-ls
or search for hidden folders only:
[Root@dabu.info ~] #find/text/pieces/clips/-type d-iname ". *"-ls
Explain:
-type: Specifies the type of file to be searched, whether it is a folder or a file, and so on, with F or D
F: The meaning of the document, the file is in English.
D: On behalf of folders, folders in English is directory
-iname: Indicates that the file name is matched, ignoring case. For example, find "fo*", then "foo", "foo" will match.
Or
[Root@dabu.info ~] #find/To find the text/pieces/folder/-path ' */.* '-print
[Root@dabu.info ~] #find/To find the text/pieces/folder/-path ' */.* '-ls
For an explanation of-path parameters, see another article, "The function of-path parameters in Find command" (meaning) explanation
In the following example, find all the hidden files and folders under $HOME ($HOME is the user's home directory, you can use (echo $HOME command to see, you know the meaning)
[Root@dabu.info ~] #find $HOME-name ". *"-ls #已经递归查询了
The output is as follows:
553607 4-rw-r--r--1 root Sep./.CSHRC
6553664 4-rw-------1 root 1024 Nov 04:40./.rnd
6553604 4-rw-r--r--1 root 2009./.bash_logout
6553665 4 drwx------2 root 4096 Dec/.GNUPG
6553671 0-rw-------1 root 0 Dec./.gnupg/secring.gpg
6553669 0-rw-------1 root 0 Dec./.gnupg/pubring.gpg~
6553673 4-rw-------1 root 899 Dec./.gnupg/pubring.gpg
6553667 8-rw-------1 root 7856 Dec./.gnupg/gpg.conf
6553668 4-rw-------1 root 1200 Dec./.gnupg/trustdb.gpg
6553602 20-rw-------1 root 17462 Apr 7 10:55./.bash_history
6553610 4 drwx------3 root 4096 2013./.config
6553660 4 drwx------2 root 4096 2013./.config/htop
6553681 4-rw-r--r--1 root 597 Apr 2013./.CONFIG/HTOP/HTOPRC
6553723 12-rw-------1 root 9629 23:56./.viminfo
6553615 4 drwxr-xr-x 3 root root 4096 Nov/.original-configs
In order to deposit the results in a text file foo.txt, use output redirection, the following command:
[Root@dabu.info ~] #find $HOME-name ". *"-ls > Foo.txt
[Root@dabu.info ~] #cat foo.txt # View the contents of the Foo.txt file, that is, the run result of the Find command
Let's say I want to see the hidden files and folders under/home/www/and save the results to foo.txt. Use the following command:
[Root@dabu.info ~] #find/home/www/-name ". *"-ls > Foo.txt