t@ubuntu:~# iostat Linux 2.6.35-22-generic (ubuntu) 04/27/2011 _i686_ (2 CPU) avg-cpu: %user %nice %system %iowait %steal %idle 11.77 0.27 1.94 0.23 0.00 85.78 Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn sda 3.39 199.43 55.77 4337613 1213008 sdb 0.01 0.09 0.00 2035 82
可能需要安装sysstat包才能使用.显示磁盘的io情况
7,vmstat命令
- root@ubuntu:~# vmstat -a
- procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
- r b swpd free inact active si so bi bo in cs us sy id wa
- 0 0 0 84420 975336 892620 0 0 74 31 728 146 12 2 86 0
显示系统当前的各种负载情况,功能很全面.
8,sar命令
- Linux 2.6.35-22-generic (ubuntu) 04/27/2011 _i686_ (2 CPU)
-
- 12:25:01 PM CPU %user %nice %system %iowait %steal %idle
- 12:35:01 PM all 11.14 0.10 1.57 0.32 0.00 86.88
- 12:45:01 PM all 12.24 0.05 2.06 0.15 0.00 85.50
- 12:55:01 PM all 13.14 0.07 2.08 0.16 0.00 84.55
- 01:05:01 PM all 10.81 0.04 1.80 0.04 0.00 87.31
- 01:15:01 PM all 12.50 0.08 2.32 0.06 0.00 85.04
所谓的瑞士****,超级全面的监控工具,光是man手册就1300多行,这个以后单独写一下,可以把上面的所有命令都替代了.
9,strace命令
- root@ubuntu:~# strace -p 5482
- Process 5482 attached - interrupt to quit
- waitpid(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0) = 5487
- --- SIGCHLD (Child exited) @ 0 (0) ---
- sigreturn() = ? (mask now [])
- waitpid(-1, 0xbfae781c, WNOHANG) = -1 ECHILD (No child processes)
- rt_sigaction(SIGINT, {0x805b950, [], 0}, NULL, 8) = 0
- rt_sigaction(SIGQUIT, {SIG_DFL, [], 0}, NULL, 8) = 0
- close(4) = 0
- chdir("/home/fenix") = 0
- ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
strace截取和记录进程的系统调用,以及收到的各种信号,监控进程的信息和状态.
10,ulimit命令
- root@ubuntu:~# ulimit -a
- core file size (blocks, -c) 0
- data seg size (kbytes, -d) unlimited
- scheduling priority (-e) 20
- file size (blocks, -f) unlimited
- pending signals (-i) 16382
- max locked memory (kbytes, -l) 64
- max memory size (kbytes, -m) unlimited
- open files (-n) 1024
- pipe size (512 bytes, -p) 8
- POSIX message queues (bytes, -q) 819200
- real-time priority (-r) 0
- stack size (kbytes, -s) 8192
- cpu time (seconds, -t) unlimited
- max user processes (-u) unlimited
- virtual memory (kbytes, -v) unlimited
- file locks (-x) unlimited
ulimit是bash内建命令,显示当前用户的shell使用限制情况.
可以使用相应的选项修改特定的值 |