We usually use chmod to change the permission of a file and or folder on Linux/Mac. When we chmod a directory recursively it also changes it's subdirectories and the files inside it to same permission.

The issue arises because we may not need the same permission for the files as like the directories. Take a website as example. Generally website files have 644 permission and directories have 755 permission.

If you have a little number of files and directories then it's okay for you to change the permissions manually per file or directory. But what about 1000s files and directories? What will you do then?

Hold on man, we are *nix users. We must have a solution!

And yes, we have a great tool called "find". You can easily look for the files or folders recursively and change the permission at a rapid mode with this tools.

I use this command to change the permission of directory only and recursively.

find . -type d -exec chmod 755 {} \;

And this command for changing the permission of files only and obviously recursively.

find . -type f -exec chmod 644 {} \;

You may do the tweaks as needed.

Not only this, you can do a lot of other things with the combination of "find" and "xargs". Find the possibilities of "find" with the commands below:

man find
man xargs




What's on your mind?


10 Comments

2da2a152ab4076b930cc594567d73abc?s=100
bangaloreinterio.com commented about 18 hours ago

Touche. Sound arguments. Keep up the great spirit.

D5f5b2f2d4d836d3584d8e43c8afdd76?s=100
csgo skins for sale commented about 16 hours ago

Greetings! I've been reading your weblog for some time now and finally got the courage to go ahead and give you a shout out from Atascocita Texas! Just wanted to mention keep up the good work!

49f8a397af3c5aaacdfceae575e887cf?s=100
Orville commented 3 days ago

Hmm is anyone else encountering problems with the images on this blog loading? I'm trying to determine if its a problem on my end or if it's the blog. Any feed-back would be greatly appreciated.

46b9b644d82695414bf69c3b31c3b412?s=100

Thanks for the good writeup. It if truth be told used to be a entertainment account it. Glance complex to more added agreeable from you! By the way, how can we communicate?

72b1bbc76fd88e8872aaf20cbddaa4fc?s=100

Hi there, I want to subscribe for this blog to take most up-to-date updates, thus where can i do it please help.

E9ee4a4034a2bbc0f2d8570e922a4db6?s=100
http://benlambpoker.com/ commented about 19 hours ago

Link exchange is nothing else but it is simply placing the other person's blog link on your page at proper place and other person will also do similar for you.

0aced8cb53fababa107ff5fa11bf51af?s=100
cs go weapon skin betting commented 3 days ago

Wow! In the end I got a web site from where I know how to truly obtain useful data regarding my study and knowledge.

484c518446f27045dca7654f0723738a?s=100
csgo skins price list commented 4 days ago

Incredible story there. What happened after? Take care!

1851f2e4e7208f30c0916c2c795531a4?s=100
Jeanette commented 4 days ago

If some one wants expert view on the topic of blogging and site-building then i advise him/her to pay a quick visit this webpage, Keep up the nice work.

Af2fce2e920bceca4d2bd16638b34a9c?s=100
giuseppe zanotti outlet commented about 1 month ago

The original version of the heel of high tops is flat; at present, high-heeled versions are marketable and more engaging to teenagers. The footwear industry is very defined; and there are no stylish and trendy options for young individuals. Finding a balance to compliment your outfit is key.