-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Both InnoDB and PostgreSQL - as well as many other databases - use a technique called multi-version concurrency control (MVCC) to provide transaction isolation: transactions should not see the work of other, uncommitted transactions. MVCC means that, when a row is updated, the database stores both the old and new versions of the row.

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Thursday, October 14, 2010

Linux Commands - Not Usual




Linux Command Tips









Check Validity of a Certificate File (PEM File)


# openssl x509 -in Certificates.pem -inform PEM -text -noout -enddate


   


    Certificate:
Data:


Version: 3 (0x2)

Serial Number:

5b:84:3e:8f:d3:1e:fc:67

Signature Algorithm: sha1WithRSAEncryption

Issuer: C=US, O=Sabe Inc., OU=Sabe Relations, CN=Sabe Certification Authority

Validity

Not Before: Oct  1 11:56:10 2011 GMT
Not After : Sep 30 11:56:10 2012 GMT










Sometime Apache process, keeps on execution (Seems like Hangs), so generally trying to get the exact PHP file that is running by Apache Process, So here is my Try.

 

I used Strace to get the opened files by the apache process. (Get PID of 

Apache process that is taking time, though you can also get it From top  command)

 

# pstree -p -n | grep http

(This will show each files that is being processed by that Apache Proc)

 

# strace -p

The list of files could also be get using lsof, but that could not be of full use, as you need the files continuusly  using by Apache Process










Create many Files Sequentially
# seq -w 1 30 | xargs -i -t zcat in_Feb2011/in_Files-{}May2011.gz | grep -E 'name.html?secsid=3304847|name.html?secsid=30780899'









Delete Empty Directories
# find folder/ -type d -empty | xargs -i -t rm -rf {}

or

# find folder/ -type d -empty -delete 









Tail, Vmstat and Date  in Loop, Output every 10 Sec
# vmstat 1 1;for ((;;));do date; vmstat 10 2 | tail -n1;done









Real Time Monitoring on Linux
# watch -n1 --difference "echo "Uptime"; uptime; echo \n ; ps -eo pcpu,pid,args | sort -k 1 -r |grep -v watch | head -10; echo "\n" ; tail /var/log/cron | grep "check_load"









Find files based and sorted on Size
# find / -type f -size +20000k -exec ls -lh {} \; 2> /dev/null | awk '{ print $NF ": " $5 }'  | sort -nrk 2,2










Check Memory Fault

# dd if=/dev/urandom bs=768304 of=/tmp/memtest count=1050

# md5sum /tmp/memtest; md5sum /tmp/memtest; md5sum /tmp/memtest









Repair Mysql MYISAM File
# myisamchk --force --sort_buffer_size=64M --key_buffer_size=16M --read_buffer_size=8M --write_buffer_size=8M ../data/phplists/phplist_linktrack.MYI










DELETE mail Que from Qmail

Steps:

# qmail stop

# find /var/qmail/queue/mess -type f -exec rm {} \;

# find /var/qmail/queue/info -type f -exec rm {} \;

# find /var/qmail/queue/local -type f -exec rm {} \;

# find /var/qmail/queue/intd -type f -exec rm {} \;

# find /var/qmail/queue/todo -type f -exec rm {} \;

# find /var/qmail/queue/remote -type f -exec rm {} \;

# qmail start









Display sorted process taking most CPU in descending order
# ps -eo pcpu,pid,user,args | sort -k 1 -r | head -10










Download FTP files Recursivly using ncftpget

Syntax:

ncftpget -R -v -u "" -p " "   

 

# ncftpget -R -v -u "ibnlive" -p "ibn123" ftpserver /temp/ /www.domain.com/2009_Feb/*










Command to make Services off in Defined Level on Linux

# chkconfig --list | awk '{print $1}' | cut -d: -f1 | grep -vE '^crond|^network|^sshd|^syslog|^iptables' | awk '{print $1}' | while read line; do chkconfig  --level 3 $line off; count=`expr $count + 1`; echo $count $line;done


or Use this... One lineer  

# chkconfig --list | awk '{print $1}'| grep -vE '^crond|^network|^sshd|^syslog|^iptables' | xargs -i chkconfig --level 3 {} off










Counting Hits from Web Server Access log

# awk '{print $1}' /opt/indian.com/access_log | grep -vE '^:|^common|^-' | sort | uniq -c | sort -nr > /var/www/reports/ips/indian.txt


or  # awk '$1>10000 {print $1}' /opt/indian.com/access_log | uniq -c | sort -nr  > /var/www/reports/ips/indian.txt

 






PERL Search and Replace Text Pattern using Perl On linux Platform
# find . -type f -name "*.html" | xargs perl -pi~ -e 's/\/js\/active18\//\/read\/js\/active18\//'

Killing processes in one Line
# kill -9 `ps -ef | grep rsync| grep -v grep| awk '{print $2}'`

Check CPU Temperature
# echo `date +%b-%d-%H:%M:%S` | tr -d '\ 012' ; echo -n ' '; sensors | awk '/CPU Temp:/{ print $3 }'
Check those commands which have been used most
# history|awk '{print $2}' |awk '{print $1}' | sort | uniq -c | sort -rn | head -10
Mount / partition in "Repair Mode" Repair filesystem
# mount -w -o remount / 

Free Memory  on Linux at Runtime
# sync
# echo 3 > /proc/sys/vm/drop_caches 


No comments:

Post a Comment