1. 程式人生 > >LNMP常用系統命令

LNMP常用系統命令

[檢視lnmp引數]
檢視nginx編譯引數:/usr/local/nginx/sbin/nginx -V
檢視apache編譯引數:cat /usr/local/apache2/build/config.nice
檢視mysql編譯引數:cat /usr/local/mysql/bin/mysqlbug | grep CONFIGURE_LINE
檢視php編譯引數:/usr/local/php/bin/php -i | grep configure 

[統計網站訪問最多IP]
# cat /data/backup/log/20151106_web3_access.log | cut -d " " -f 1-3 |sort |uniq -c |sort -rn |head
# cat  /data/backup/log/20151106_web3_access.log  | awk '{print $7}' | sort | uniq -c | sort -k1 -nr |head -n10

註釋
cut -d " " -f 1        -d用空格分割,-d取分割後的第一列   
sort                    排序
uniq -c               統計重複的行,-c在重複的行前面顯示重複次數
sort -nr               -n數字排序,-r求逆
head                    取前十行(預設)