preload
Mar 12

記錄一下這幾個連結

http://tldp.org/LDP/Bash-Beginners-Guide/html/index.html

http://ppewww.physics.gla.ac.uk/~chrisc/SUPA/lecturenotes/bash/bash.html

常有機會寫 bash 但是bash還是不熟悉.

Tagged with:
Mar 09

[root@cluster1 ~]$  top -b -n 1 |sed -n -e “8,`cat /proc/cpuinfo | grep processor | tail -n 1 | awk ‘{print $3 + 8}’`p”|awk ‘{print $12, $2, $9, $10, $11}’
program1 user1 100 2.0 9601:56
program1 user1 96 2.0 9603:33
program1 user1 96 2.0 9605:35
program1 user1 96 2.0 9600:51
program1 user1 96 2.0 3836:43
program1 user1 94 2.0 9600:06
top root 2 0.0 0:00.02
init root 0 0.0 0:03.95

Tagged with:
Mar 09

[root@cluster1 ~]$  cat /proc/cpuinfo | grep processor | tail -n 1 | awk ‘{print $3 + 1}’

Tagged with:
Jan 09
ssh bc$((` hostname -s| awk -F "" '{ print $3$4 }'` + 14))
Tagged with:
Oct 13

grep “Failed password for invalid user” /var/log/secure | awk ‘{print substr($13,8)}’ | awk ‘{count[$1]++} END  { for( i in count ) { if ( count[i] >= 3 ){print i ” Total Failed Attempts: ” count[i] “”} }}’

Tagged with:
Aug 14

#!/bin/bash while [ 1 ] do /usr/sbin/ntpdate -u time.tiara.sinica.edu.tw sleep 1 done

Tagged with:
Jun 18

[root@bt1 ~]# for ((i=1;i<=14;i+=1)); do scp -r /etc/krb5.conf bc$i:/etc/; done

Tagged with:
Jul 12

ps | grep test | awk ‘{print $1}’ | xargs kill

Tagged with:
Feb 05

If I would like to replace all ‘.html’ pattern to ‘.php’ in all html file, that will be like as following:
# find . -name “*.html” -exec perl -pi -e ‘s/.html/.php/g;’ {} \;

Tagged with: