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

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 user.group .*

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 user.group .

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

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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