Linux Tips I Wish I Knew Long Ago – Chmod Hidden Files

I’ve often needed to change the owner of a bunch of files in a directory. My standard goto has always been:
chmod -R *

The problem is home directories where you have hidden files (or call dot files they are just files with a “.” prefix, like “.ssh”). To get these I’ve always down the individual directories, though occasionally I make the mistake of:
chmod -R .*

Which is very bad, because it will transverse up to the parent directory and change those too (which means all the user directories, not just the dot directories you want).

The proper way to do it is:
chmod -R .

What actually happens is that the . is the current directory and combined with the recursive flag you get all the files you want. So simple, so close, now I need to break my bad habit and use this new way as my standard go to.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.