Bulk rename in Unix

To change .htm files to .html
$for file in *.htm ; do mv $file `echo $file | sed 's/\(.*\.\)htm/\1html/'` ; done

Posted bySeshu Karthick at 12:50 PM  

Large deletes in Unix

If there are too many files to be deleted at once, the 'rm -f' command does not work. It throws up an error that states "/bin/rm: Argument list too long". So, here is a solution...

$find -name '*.txt' -exec rm -f {} \;

Here we find each entry that matches the pattern *.txt, and execute the command rm -f on it.
Courtesy: Thanks to my team lead for this tip.

Posted bySeshu Karthick at 12:20 PM  

Crash the kernel

To crash the UNIX kernel, type the following on its command prompt...
$ echo c > /proc/sysrq-trigger

Posted bySeshu Karthick at 8:47 AM