同步时间
yum install ntpdate
ntpdate cn.pool.ntp.org
linux资源监控
1.下载安装包tsar,依赖gcc yum -y install gcc gcc-c++ / git clone git://github.com/kongjian/tsar.git
2.解压编译安装执行make 再执行make install
3.监控tsar -i 1 -l
进程端口查看
netstat -nlp | grep 9169 //9169表示进程id
查看服务端连接数
netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'
日志排序 ll -lrt
查看cpu数量与单个cpu的核心数
cat /proc/cpuinfo | grep processor | wc -l
查看系统总内存与使用内存
free -h
cpu内存,磁盘使用率
free -m | awk 'NR==2{printf "Memory Usage: %s/%sMB (%.2f%%)\n", $3,$2,$3*100/$2 }'
df -h | awk '$NF=="/"{printf "Disk Usage: %d/%dGB (%s)\n", $3,$2,$5}'
top -bn1 | grep load | awk '{printf "CPU Load: %.2f\n", $(NF-2)}'