1) top或者ps -ef | grep tomcat-web执行查看进程号
2) netstat -anop | grep 8000 执行查看进程号
3) ls -l /proc/20214 列出指定进程号的详细信息,其中exe行是运行程序的目录
cat /proc/20974/cmdline 查看启动时的命令行参数
cat /proc/20974/environ 查看启动时的环境变量
4) 系统分析工具
[root@base /]# uptime
16:18:26 up 29 days, 1:27, 1 user, load average: 0.00, 0.00, 0.00
top - 16:18:59 up 29 days, 1:28, 1 user, load average: 0.00, 0.00, 0.00
Tasks: 141 total, 1 running, 140 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.2%us, 0.2%sy, 0.0%ni, 99.6%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 8061216k total, 4989352k used, 3071864k free, 277284k buffers
Swap: 4194300k total, 151872k used, 4042428k free, 791076k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2137 root 20 0 4349m 130m 9092 S 0.3 1.7 69:49.37 java
2255 root 20 0 125m 1996 796 S 0.3 0.0 46:38.63 redis-serve
[root@base /]# mpstat
Linux 2.6.32-573.el6.x86_64 (base) 11/09/2016 _x86_64_(4 CPU)
04:20:52 PM CPU %usr %nice %sys %iowait %irq %soft %steal %guest %idle
04:20:52 PM all 0.30 0.00 0.20 0.00 0.00 0.01 0.00 0.00 99.49
[root@base /]# iostat
Linux 2.6.32-573.el6.x86_64 (base) 11/09/2016 _x86_64_(4 CPU)
avg-cpu: %user %nice %system %iowait %steal %idle
0.30 0.00 0.21 0.00 0.00 99.49
Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
scd0 0.00 0.00 0.00 264 0
sda 1.20 1.31 14.97 3294692 37590088
dm-0 0.04 0.06 0.24 143112 610400
dm-1 1.35 0.66 10.61 1662130 26644512
dm-2 0.53 0.58 4.12 1463922 10335064
[root@base /]# vmstat
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 151872 3071508 277284 791092 0 0 0 2 3 3 0 0 99 0 0
[root@base /]# free
total used free shared buffers cached
Mem: 8061216 4989708 3071508 8 277284 791092
-/+ buffers/cache: 3921332 4139884
Swap: 4194300 151872 4042428
[root@base /]# nicstat
Time Int rKB/s wKB/s rPk/s wPk/s rAvs wAvs %Util Sat
16:22:10 lo 0.86 0.86 10.54 10.54 83.87 83.87 0.00 0.00
16:22:10 eth0 7.72 6.88 21.95 23.94 360.1 294.3 0.01 0.00
[root@base /]# dstat
----total-cpu-usage---- -dsk/total- -net/total- ---paging-- ---system--
usr sys idl wai hiq siq| read writ| recv send| in out | int csw
0 0 99 0 0 0| 672B 7665B| 0 0 | 29B 124B| 405 492
[root@base /]# sar
Linux 2.6.32-573.el6.x86_64 (base) 11/09/2016 _x86_64_(4 CPU)
04:00:01 PM CPU %user %nice %system %iowait %steal %idle
04:10:01 PM all 0.22 0.00 0.17 0.00 0.00 99.61
04:20:01 PM all 0.39 0.00 0.20 0.06 0.00 99.36
Average: all 0.30 0.00 0.19 0.03 0.00 99.48
[root@base /]# netstat -ano | grep 6379
tcp 0 0 0.0.0.0:6379 0.0.0.0:* LISTEN off (0.00/0/0)
tcp 0 0 192.168.1.116:57997 192.168.1.116:6379 ESTABLISHED keepalive (140.09/0/0)
tcp 0 0 192.168.1.116:6379 192.168.1.116:57997 ESTABLISHED keepalive (140.08/0/0)
tcp 0 0 :::6379 :::* LISTEN off (0.00/0/0)
tcp 0 0 ::ffff:192.168.1.116:44953 ::ffff:192.168.1.101:6379 ESTABLISHED keepalive (4956.67/0/0)
tcp 0 0 ::ffff:192.168.1.116:48178 ::ffff:192.168.1.101:6379 ESTABLISHED keepalive (7182.90/0/0)
[root@base /]# pidstat -p 2259
Linux 2.6.32-573.el6.x86_64 (base) 11/09/2016 _x86_64_(4 CPU)
04:33:56 PM PID %usr %system %guest %CPU CPU Command
04:33:56 PM 2259 0.04 0.07 0.00 0.11 2 redis-server