Finding hidden files in Linux using the Find command

Source: Internet
Author: User
Tags config gnupg gpg

We can use the Find command on Linux or Unix systems to query all (all) hidden files

The basic syntax is as follows:

The code is as follows:

[ ~] #find/The text/pieces/clips/-name to find ". *"-print


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


The code is as follows:

[ ~] #find/The text/pieces/clips/-name to find ". *"-ls

Or search for hidden files only:

The code is as follows:

[ ~] #find/text/pieces/clips/-type f-iname ". *"-ls

or search for hidden folders only:

The code is as follows:

[ ~] #find/text/pieces/clips/-type d-iname ". *"-ls


-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.


The code is as follows:

[ ~] #find/To find the text/pieces/folder/-path ' */.* '-print

[ ~] #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)

The code is as follows:

[ ~] #find $HOME-name ". *"-ls #已经递归查询了

The output is as follows:

The code 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:

The code is as follows:

[ ~] #find $HOME-name ". *"-ls > Foo.txt

[ ~] #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:

The code is as follows:

[ ~] #find/home/www/-name ". *-ls > Foo.txt

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.