The following command will execute a command on a directory and all its sub-directories:
$ find plugins -type d -exec chmod g+w {} \;
In this case, we’re changing the group permissions on the plugins directory and all sub-directories.
The following command will execute a command on a directory and all its sub-directories:
$ find plugins -type d -exec chmod g+w {} \;
In this case, we’re changing the group permissions on the plugins directory and all sub-directories.
If you’ve recently installed an application or applied some patches that begin to generate a lot of SELinux audit entries, you can update your local policy to accommodate your recent changes. Please note that this isn’t a substitute for ensuring your files have the appropriate selinux roles and types.
# grep avc /var/log/audit/audit.log | audit2allow -M mypol # semodule -i mypol.pp
I have recently been tinkering with ruby on rails again and was banging my head against the wall with a multiple select list for a “has and belongs to many” relationship between models. After a lot of Googling and experimenting I finally got it running. The resulting code is deceptively simple!
This example illustrates the relationship between users and their roles. Each user can have multiple roles, and each role can have multiple users.
I recently came across a command that allows me to search and replace a string of text in all files within a directory structure. This is very useful for updating static information in HTML files and the like.
find ./ -iname \*.htm\* -exec sed -i 's/www\.example\.com/www2\.example\.com/g' {} \;
Note that you must denote special characters with the backslash character (e.g., the dots in www.example.com).
I recently found myself needing to locate all world writable files in a directory tree and came across the following useful command:
find /var/ -type d -perm -o+w -exec ls -ld {} \;
The syntax may vary depending on the flavour of Unix/Linux you’re using, but this worked on Ubuntu for me.