Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to change permission of each files in a directory. I've been using chmod 777 but its wasting time if I have 50 files.

How to make all files inside directory become rwx without change them one by one?

share|improve this question
up vote 7 down vote accepted

chmod -cR 777 *

Will change all the files including subdirectories recursively (R option) including subdirectories, but also report on when it makes a change (c option).

Rather than changing all the files with too wide permissions, you might want to change the ownership instead.

sudo chown -hR tomcat

The line above changes owndership to a tomcat application server, you need to figure out which user your webserver is using. You can easily see that by doing

ps aux

(The h option is for changing the owndership of a symbolic link if encountered, but not the files it linkes to)

share|improve this answer

What you are doing is more than likely unsafe and the below command should only be invoked if you completely accept the security issues.

find . -type d -exec chmod 777 '{}'* \;

This will recursively go through the current directory and each subdirectory and change the permissions accordingly; if I haven't made it clear enough, this is a very bad idea (777 permissions)

share|improve this answer

This script will execute the command for all files in the current directory:

sudo find . -name "*" | awk '{print("chmod 777 "$1)}'| /bin/sh

To test the script first, you can just output the statements without piping them to the shell to be executed:

sudo find . -name "*" | awk '{print("chmod 777 "$1)}'

This same pattern using awk is generally useful for performing batch shell commands.

share|improve this answer

Just type:

chmod 777 *
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .