1. uptime
$ uptime
23:51:26 up 21:31, 1 user, load average: 30.02, 26.43, 19.0212
該命令可以大致的看出計(jì)算機(jī)的整體負(fù)載情況,load average后的數(shù)字分別表示計(jì)算機(jī)在1min、5min、15min內(nèi)的平均負(fù)載。
2. dmesg | tail
$ dmesg | tail
[1880957.563150] perl invoked oom-killer: gfp_mask=0x280da, order=0, oom_score_adj=0
[...]
jun 25 01:08:09 sip-db kernel: out of memory: kill process 30344 (oracle) score 54 or sacrifice child。the result is 2 hello worlds, the child process will execute the fork after ||, but for && the child process will start after printf. since the parent process get an id and child process get an 0. #include #include using namespace std。2009-01-22?06:54:33?thread-4105165728?error?command:?failed?to?kill?process?4793?running?perl:?( 。
oct3 22:17:25 server5 init: tty (/dev/tty3) main process (3274) killed by term signal。oct3 22:17:25 server5 init: tty (/dev/tty2) main process (3272) killed by term signal。oct3 22:17:25 server5 init: tty (/dev/tty5) main process (3279) killed by term signal。
[2320864.954447] TCP: Possible SYN flooding on port 7001. Dropping request. Check SNMP counters.123456
打印內(nèi)核環(huán)形緩存區(qū)中的內(nèi)容,可以用來(lái)查看一些錯(cuò)誤;
上面的例子中,顯示進(jìn)程18694 因引內(nèi)存越界被kill掉以及TCP request被丟棄的錯(cuò)誤。通過(guò)dmesg可以快速判斷是否有導(dǎo)致系統(tǒng)異常的問(wèn)題。
3. vmstat 1
$ vmstat 1
procs ---------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
34 0 0 200889792 73708 591828 0 0 0 5 6 10 96 1 3 0 0
32 0 0 200889920 73708 591860 0 0 0 592 13284 4282 98 1 1 0 0
32 0 0 200890112 73708 591860 0 0 0 0 9501 2154 99 1 0 0 0