Piping to xargs is a dirty way of doing that which can be done inside of find.

  1. find . -type d -exec chmod 0755 {} \;
  2. find . -type f -exec chmod 0644 {} \;

You can be even more controlling with other options, such as:

  1. find . -type d -user harry -exec chown daisy {} \;

You can do some very cool things with find and you can do some very dangerous things too. Have a look at “man find”, it’s long but is worth a quick read. And, as always remember:

If you are root it will succeed.
If you are in root (/) you are going to have a bad day.
Using /path/to/directory can make things a lot safer as you are clearly defining where you want find to run.

分类: web

标签:   linux   nginx