1. uptime
$ uptime
23:51:26 up 21:31, 1 user, load average: 30.02, 26.43, 19.0212
该命令可以大致的看出计算机的整体负载情况,load average后的数字分别表示计算机在1min、5min、15min内的平均负载。
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
打印内核环形缓存区中的内容,可以用来查看一些错误;
上面的例子中,显示进程18694 因引内存越界被kill掉以及TCP request被丢弃的错误。通过dmesg可以快速判断是否有导致系统异常的问题。
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