Linux Commands - find command - hidden files and directories

by
Jeremy Canfield |
Updated: August 30 2022
| Linux Commands articles
If you are not familiar with the find command, check out our Getting Started article.
Let's say /tmp/example contains both hidden and non-hidden files.
/tmp/example/foo.txt
/tmp/example/.bar.txt
/tmp/example/.hidden_directory
The following command can be used to return both hidden and non-hidden files and directories.
find /tmp/example -name "*"
The following should be returned.
/tmp/example
/tmp/example/foo.txt
/tmp/example/.bar.txt
/tmp/example/.hidden_directory
The following command can be used to only return the hidden files and directories.
find /tmp/example -name ".*"
The following should be returned.
/tmp/example/.bar.txt
/tmp/example/.hidden_directory
And here is how you would exclude hidden files and directories.
find /tmp/example -not -name ".*"
The following should be returned.
/tmp/example
/tmp/example/foo.txt
Did you find this article helpful?
If so, consider buying me a coffee over at