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

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 ! -name ".*"

 

The following should be returned.

/tmp/example
/tmp/example/foo.txt

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




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




Comments

Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |