1、取得cpu的占用率,可以取得cpu的空闲的值 top -n 1 |grep Cpu | cut -d "," -f 4 其中4是指第4列 2、取得内存 top -n 1 |grep Mem | cut -d "," -f 2