Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Jan 022010
 

How to mass rename file in Bash

Answer:

For example, you might want to rename *.htm to *.html, create the following scripts

vi rename.sh

And enter

#!/bin/bash 

for f in *.htm; do
    mv $f ${f%htm}html
done

Execute the script and it does all the rename magics.

Jan 012010
 

Delete svn folders and files

Answer:

After checkout from the svn repository using the svn checkout command , if you want to remove the svn related files/folders, use the following command under the working directory

find ./ -name ".svn" | xargs rm -rf

On the other hand, you should use svn export, instead of svn checkout if you don't want the svn related files/folders at the beginning.

Jan 012010
 

Increase PHP memory limit

Answer:

If you experienced error such as "Fatal error: Allowed memory size of 16777216 bytes exhausted ", you would need to increase the memory limit of your PHP, by editing the php.ini

vi /etc/php.ini

Locate and set

memory_limit = 32M ;

Try it with the number you need.

Jan 012010
 

Turn off PHP error messages?

Answer:

In a production server, you should always turn off PHP error messages to be displayed for public, to do so, edit the php.ini

E.g.

vi /etc/php.ini

And turn off display_errors

display_errors = Off