1. ps -aux:查看当前进程的信息
-a 显示所有的进程,包含每个命令的完整路径
-x 显示所有系统程序,包括那些没有终端的程序
-u 显示使用者的名称和起始时间
[hadoop@hadoop000 ~]$ ps -aux
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.3 0.0 19356 1540 ? Ss 15:24 0:01 /sbin/init
root 2 0.0 0.0 0 0 ? S 15:24 0:00 [kthreadd]
root 3 0.0 0.0 0 0 ? S 15:24 0:00 [migration/0]
root 4 0.0 0.0 0 0 ? S 15:24 0:00 [ksoftirqd/0]
root 5 0.0 0.0 0 0 ? S 15:24 0:00 [migration/0]
root 6 0.0 0.0 0 0 ? S 15:24 0:00 [watchdog/0]
root 7 0.0 0.0 0 0 ? S 15:24 0:00 [migration/1]
root 8 0.0 0.0 0 0 ? S 15:24 0:00 [migration/1]
root 9 0.0 0.0 0 0 ? S 15:24 0:00 [ksoftirqd/1]
root 10 0.0 0.0 0 0 ? S 15:24 0:00 [watchdog/1]
root 11 0.0 0.0 0 0 ? S 15:24 0:00 [migration/2]
root 12 0.0 0.0 0 0 ? S 15:24 0:00 [migration/2]
root 13 0.0 0.0 0 0 ? S 15:24 0:00 [ksoftirqd/2]
root 14 0.0 0.0 0 0 ? S 15:24 0:00 [watchdog/2]
root 15 0.0 0.0 0 0 ? S 15:24 0:00 [migration/3]
root 16 0.0 0.0 0 0 ? S 15:24 0:00 [migration/3]
root 17 0.0 0.0 0 0 ? S 15:24 0:00 [ksoftirqd/3]
root 18 0.0 0.0 0 0 ? S 15:24 0:00 [watchdog/3]
root 19 0.0 0.0 0 0 ? S 15:24 0:00 [events/0]
root 20 0.0 0.0 0 0 ? S 15:24 0:00 [events/1]
root 21 0.0 0.0 0 0 ? S 15:24 0:00 [events/2]
2.top实时查看进行状态,top出来的结果会动态变化
top动态查看
top
top - 15:42:52 up 18 min, 1 user, load average: 0.00, 0.00, 0.00
Tasks: 152 total, 1 running, 151 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.0%us, 0.1%sy, 0.0%ni, 99.8%id, 0.0%wa, 0.0%hi, 0.1%si, 0.0%st
Mem: 3916936k total, 365048k used, 3551888k free, 27676k buffers
Swap: 2031608k total, 0k used, 2031608k free, 154364k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
21 root 20 0 0 0 0 S 0.3 0.0 0:00.03 events/2
1 root 20 0 19356 1540 1228 S 0.0 0.0 0:01.72 init
2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd
3 root RT 0 0 0 0 S 0.0 0.0 0:00.31 migration/0
4 root 20 0 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/0
5 root RT 0 0 0 0 S 0.0 0.0 0:00.00 migration/0
6 root RT 0 0 0 0 S 0.0 0.0 0:00.00 watchdog/0
7 root RT 0 0 0 0 S 0.0 0.0 0:00.00 migration/1
8 root RT 0 0 0 0 S 0.0 0.0 0:00.00 migration/1
9 root 20 0 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/1
10 root RT 0 0 0 0 S 0.0 0.0 0:00.00 watchdog/1
11 root RT 0 0 0 0 S 0.0 0.0 0:00.00 migration/2
12 root RT 0 0 0 0 S 0.0 0.0 0:00.00 migration/2
13 root 20 0 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/2
14 root RT 0 0 0 0 S 0.0 0.0 0:00.00 watchdog/2
15 root RT 0 0 0 0 S 0.0 0.0 0:00.00 migr
3.netstat -nltp:查看网络端口
-a (all)显示所有选项,默认不显示LISTEN相关
-t (tcp)仅显示tcp相关选项
-u (udp)仅显示udp相关选项
-n 拒绝显示别名,能显示数字的全部转化成数字。
-l 仅列出有在 Listen (监听) 的服務状态
-p 显示建立相关链接的程序名
-r 显示路由信息,路由表
-e 显示扩展信息,例如uid等
-s 按各个协议进行统计
-c 每隔一个固定时间,执行该netstat命令。
[hadoop@hadoop000 ~]$ netstat -nltp
(No info could be read for "-p": geteuid()=501 but you should be root.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:587 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:465 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN -
tcp 0 0 :::587 :::* LISTEN -
tcp 0 0 :::111 :::* LISTEN -
tcp 0 0 :::465 :::* LISTEN -
tcp 0 0 :::22 :::* LISTEN -
tcp 0 0 ::1:631 :::* LISTEN -
tcp 0 0 :::25 :::* LISTEN -