How to recursively list all hidden files and directories?
If using GNU find, you can do
find /path -path '*/.*' -ls | tee output-file
Edit
To avoid to show non-hidden items contained in hidden directories
find /path -name '.*' >output-file
(as noted, tee
could be avoided if you do not need to see the output, and -ls
option should be used only if required).
To list the hidden files and directories in the current directory, including .
and ..
:
echo .*
To list the hidden files and directories in the current directory and its subdirectories recursively:
find . -name '.*'
If you want to save the results to a file, use a redirection:
find . -name '.*' >output-file.txt