Posts

Showing posts from December, 2013

Command to search a particular word in multiple files under the parent directory.

To execute this command first go the parent directory then use the following command:- find . -type f -print0 | xargs -0 grep lover /dev/null this will find all the files/lines which includes the word ''lover'' under the parent directory from which the command is executed.

linux command to find and change a value in multi files

linux command to find and change a value in multi files find . -name "*.php" -print | xargs sed -i 's/power/strong/g' here  *.php will search for all files that ends with .php ''power''  is the value to be searched and ''strong'' in the value to be replaced

Linux Command to change the permisson of multiple directories/files having the same name

Command to change directory permission of multi directories with the same name :- find -name 'power' -type d -exec chmod 0777 {} \; here will search for the directories named ‘power’ all directories inside from the parent directory and change the permission to 777. Command to change directory permission of multi directories with the same name :- find -name 'power' -type f -exec chmod 0644 {} \;     here will search for the files named ‘power’ all directories inside from the parent directory and change the permission to 644.

Backup and restore multiple databases using linux command mysqldumb

 Backup and restore database using linux command mysqldumb is the simplest and the easier method.  For taking backup of all databases:-  mysqldump -u root -p --all-databases > dumb.sql  For Restoring the databases:-  mysql -u root -p < dumb.sql Its that easy.