ps -ef|grep tomcat
直接查看指定端口的进程pid netstat -anp| grep 9217
netstat -lnp | grep memcached
kill -9 26127 du -sh ./* 占多大
df -hl
free ls | wc 有多少个数量
lsof -i:8087 ./catalina.sh run
究竟应该如何查看平均负载呢?最简单的命令是uptime,如下所示:
[root@localhost ~]# uptime 11:31:11 up 11 days, 19:01, 2 users, load average: 0.02, 0.01, 0.00 |
还可以用w命令来查看,顺便可以查看一下系统当前有哪些用户,他们占用了哪些终端,如下所示:
[root@localhost ~]# w 11:33:00 up 11 days, 19:03, 2 users, load average: 0.00, 0.00, 0.00 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT root pts/1113.57.224.3 09:032:11m 0.04s 0.04s -bash root pts/2113.57.224.3 11:310.00s 0.02s 0.00s w |
另外,还有动态命令top,这个命令也可以反映系统负载情况。在下面的命令提示中,我们只关心加粗字体部分。
[root@localhost ~]# top top - 11:37:47 up 11 days, 19:08, 2 users, load average: 0.00, 0.00, 0.00 Tasks: 122 total, 1 running, 121 sleeping, 0 stopped, 0 zombie Cpu(s): 0.1%us, 0.0%sy, 0.0%ni, 99.9%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st Mem: 4044136k total, 1435504k used, 2608632k free, 274740k buffers Swap: 8193140k total,0k used, 8193140k free, 941884k cached |
3,查看cpu
cat /proc/cpuinfo
只看cpu数量grep "model name" /proc/cpuinfo | wc -l
4,查看系统内存
cat /proc/meminfo