Bootstrap FreeKB - Linux Commands - find command - hidden files and directories
Linux Commands - find command - hidden files and directories

Updated:   |  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 Buy Me A Coffee



Comments


Add a Comment


Please enter 29f2ae in the box below so that we can be sure you are a human.