Useful Shell Commands
Useful Shell Commands
ssh-keygen -t dsa it will generate a pair of private and public keys in: ${user.home}/.ssh/id_dsa ${user.home}/.ssh/id_dsa.pub add the public keys to server's ${user.home}/.ssh/authorized_keys create the file if it's not existed. Mount USB /sbin/fdisk -l mount -t vfat -v /dev/sdb /media/MI-MEE/ Find and Replace cat filename | sed -e '/text/newtext/g' Find and Replace in a Folder cd /app/conf for y in `ls *`; do sed -e 's/10.32.6.244/10.32.15.164/g' $y > temp; mv temp $y; done Remove CVS files: find . -name CVS -prune -exec rm -rf {} \; Refresh font cache: fc-cache -f -v Compare 2 directories: comm <(ls ~/dir-new/) <(ls ~/dir) Check CVS history: cvs -d :pserver:[email protected]:/cvs/cvs-documentation log -R yudi-doc/ Drop index keys of a database (except PRIMARY key): #!/bin/sh db=$3 user=$1 pswd=$2 mysql -u$user -p$pswd -e "show tables from $db"| awk '{if(NR>1) print "show index from "$1";"}'| mysql -u$user -p$pswd $db| awk '{if($3 !~ /Key_name/ && $3 !~ /PRIMARY/) print $1" "$3}'| awk '{print "alter table "$1" drop index "$2";"}' GIT