Bulk rename in Unix
Wednesday, October 31, 2007
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
Labels: linux
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
Labels: linux
Crash the kernel
Wednesday, October 3, 2007
To crash the UNIX kernel, type the following on its command prompt...
$ echo c > /proc/sysrq-trigger
Posted bySeshu Karthick at 8:47 AM
Labels: linux
Subscribe to:
Posts (Atom)