1. To print natural numbers
for i in `seq 1 10` ;do echo $i;done;
2.To print a-z
for i in {a..z};do echo $i;done;
3.To delete all the accounts from a server
for i in `cat /etc/userdomains`;do /scripts/killacct;done;
4.sed -i s/on/off/g php.ini
this will on all off options
5.for i in `cat new2.txt` ; do echo "-------------------$i----------------";ssh -p 1291 -l root $i /usr/local/apache/bin/httpd -v ; e ;done
to fine out version of apache of servers in the file new2.txt
6.grep server version?
for i in `cat new2.txt` ; do echo "-------------------$i----------------";ssh -p 1291 -l root $i /usr/local/apache/bin/httpd -v | grep "Server version" ; e ;done
7. To find out mysql db user?
find /home/costagr/public_html -type f -exec grep -H username_ '{}' \;
8. To copy zone files into a file
ll | awk print '{print $9}'| cat > test
9. Script to replace email id in zone file
for i in `cat /var/named/test` ; do sed -i 's/judyndenis.yahoo.com/convergencecos.gmail.com/g' $i; done
10.script to copy usernames into a file
cat /etc/userdomains | cut -d ':' -f2 >> domaintxt
11. cut command
cat all.txt | cut -d ',' -f2-4 | sort > new.txt
12. It will list 10 files in the decreasing order according to their size
ls -al -SR | head -10
13. Script To watch load for each second ?
watch -n1 w
14. To find out the all space used by a reseller
for a in `grep resellerlogin /etc/trueuserowners | cut -d":" -f1`; do quota -s $a| tail -n 1 | awk {'print $2'};done
15. Replace command
replace 'source' 'destintaion' -- filename
eg; need to change jibin in file.txt to A
replace 'jibin' 'A' -- file.txt
No comments:
Post a Comment