Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?
You must be signed in to comment.
commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.
Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):
Subscribe to the feed for:
find . -type d -exec chmod 755 {} +;
{} +: to let it behave like using xargs the same command has been posted beforefind . -type d -print0 | xargs -0 chmod 755
1. It is much faster of large amounts of files because chmod does not get invoked for every file seperately. 2. And besides null terminating the file name takes care of nasty spaces|quotes|your-favorite-non-printable-characters in file names. 3. Same goes for files:find . -type f -print0 | xargs -0 chmod 644
chmod 755 **/*(/)
It's fast, efficient and works with all filenames (spaces and anything). To do the same with plain files:chmod 644 **/*(.)
For those not familiar with zsh wildcards, this is how the above commands work: "**" is the same as "*", but it works recursively down the directory tree, so you don't have to use the find command. Any wildcard pattern can be followed by a set of flags in parentheses (there must be no space between!): "(/)" restricts the matches to directories only, and "(.)" does the same for plain files. There are many more wildcards and flags; this is just the tip of the iceberg.find . -type d -print0 | xargs -0 chmod 755
+1; xargs is betterfind . ! -perm /g=r -exec chmod g+r {} +
a lot: turns on the group readable bit for any files that don't currently have it on, in one invokation of chmod.