LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   finding hidden files (https://www.linuxquestions.org/questions/linux-newbie-8/finding-hidden-files-631002/)

dina3e 03-27-2008 08:25 AM

finding hidden files
 
is there any other way i suppose to find out the hidden file in the system other than
ls -a

pixellany 03-27-2008 08:30 AM

find <path> -name '.*'

colucix 03-27-2008 08:34 AM

The find command retrieves the hidden files, too. If you want to find ONLY the hidden files and directories, you can use the -regex option in this way
Code:

find . -regex '.*/\..*'
Edit: ...or the way pixellany suggested. Indeed, mine is useful when you want to exclude hidden files from the search, as in
Code:

find . \( ! -regex '.*/\..*' \)

dina3e 03-27-2008 07:57 PM

this works fine
 
Quote:

Originally Posted by colucix (Post 3101951)
The find command retrieves the hidden files, too. If you want to find ONLY the hidden files and directories, you can use the -regex option in this way
Code:

find . -regex '.*/\..*'
Edit: ...or the way pixellany suggested. Indeed, mine is useful when you want to exclude hidden files from the search, as in
Code:

find . \( ! -regex '.*/\..*' \)

yha this works fine but i want to know that any other method or command so that i'll get the hidden file information.

colucix 03-28-2008 04:46 AM

Once you have found the hidden files, you can execute any command on each entry. Suppose you have
Code:

$ find . -regex '.*/\..*'
./.hiddenfile_1
./.hiddenfile_2

You can add the -exec option to the find command and get for example
Code:

$ find . -regex '.*/\..*' -exec ls -l {} \;
-rw-r--r-- 1 colucix users 11 Mar 28 10:40 ./.hiddenfile_1
-rw-r--r-- 1 colucix users 20 Mar 28 10:43 ./.hiddenfile_2

$ find . -regex '.*/\..*' -exec file {} \;
./.hiddenfile_1: ASCII text
./.hiddenfile_2: ASCII text

See man find for details.


All times are GMT -5. The time now is 09:02 PM.