How to chmod and chown hidden files in Linux?

How do I recursively execute chmod or chown for hidden files?

sudo chmod -R 775 * does not work on hidden files.

The same thing goes for sudo chown -R user:group.


If you're okay also chmod'ing the current directory, do that and let -R do the heavy lifting. -R does not ignore hidden files.

sudo chmod -R 775 .

* doesn't include hidden files by default, but if you're in bash, you can do this with:

shopt -s dotglob

Read more about it in bash's builtin manual:

If set, Bash includes filenames beginning with a `.' in the results of filename expansion.

This will make * include hidden files too.

chmod -R 775 *

Disable it with:

shopt -u dotglob

Another option is to use find i like it since you can have very fine grained control over it.

find <path to start from> -exec chown <options> {} \+

find -path '<path to include>' -exec chown <options> {} \+

The only downside is that find has different syntax on different versions.