November 28th, 2011 |
admin |
netstat -an |grep 80 netstat -plan|grep :80|awk {’print $5′}|cut -d: -f 1|sort|uniq -c|sort -nk 1 netstat -plan|grep :25|awk {’print $5′}|cut -d: -f 1|sort|uniq -c|sort -nk 1 watch -n 5 ‘w; ls -alS /usr/local/apache/domlogs/ ‘ Incoming search terms:centos ddos (3)ddos centos (2)apache detect ddos (1)locate ddos file in linux (1)linux find * -name (1)how to detect [...]
November 28th, 2011 |
admin |
this script to help install ruby on rails cd /usr/src wget ftp://ftp.ruby-lang.org/pub/ruby/ruby-1.8.5.tar.gz tar -xzvf ruby-1.8.5.tar.gz cd ruby-1.8.5/ ./configure make make test make install cd /usr/src wget http://rubyforge.org/frs/download.php/5207/rubygems-0.8.11.tgz tar -zxvf rubygems-0.8.11.tgz cd rubygems-0.8.11 ruby setup.rb gem update gem install rails –include-dependencies rails /usr/local/rails mv /usr/local/rails/public/.htaccess /usr/local/rails/public/.htaccessfile echo “RewriteBase /rails” > /usr/local/rails/public/.htaccess cat /usr/local/rails/public/.htaccessfile >> /usr/local/rails/public/.htaccess mv /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conffile [...]
November 28th, 2011 |
admin |
========================= Resore pkg cat /root/finallist | awk -F. ‘{print $1}’ > /root/list0 for i in `cat /root/list0`;do /scripts/restorepkg $i;done ========================= to copy the dailybackups for a list of users to a user home from server backup #!/bin/bash for i in `cat /root/thewebcousers`; do cp -rp /backup/cpbackup/daily/$i.tar.gz /home/thewebco chown thewebco.thewebco /home/thewebco/$i.tar.gz done ========================= #!/bin/bash for i [...]
November 28th, 2011 |
admin |
Q. How do I convert uppercase words to lowercase or vise versa under BASH shell? I’ve a small shell script and I’d like to convert all incoming user input to lowercase using a shell script. A. Use tr command to convert all incoming text / words / variable data from upper to lower case or [...]
November 28th, 2011 |
admin |
I want to get an alert when my disk is full under UNIX and Mac OS X? How do I set a a specified threshold and run the script via cron? The df command report file system disk space usage including the amount of disk space available on the file system containing each file [...]
November 28th, 2011 |
admin |
Q. How do I specify MySQL SQL queries on the UNIX / Linux command line? A. mysql command line has option to execute the SQL statement and quit. This is also useful for running sql queries from a shell script. Following is the syntax: mysql -u user -p -e ‘SQL Query’ database Where, -u [...]
November 28th, 2011 |
admin |
Q. How do I search multiple string using grep command? For example I’d like to search word1, word2, word3 and so on within /path/to/file. How do I force grep to search multiple words? A. grep command supports regular expression pattern Grep command example To search multiple words, use following syntax: grep ‘word1|word2|word3‘ /path/to/file For [...]