linux ps命令
1 查看进程
1.1ef参数
# 显示所有命令,连带命令行
ps -ef | grep java | grep gitbook
# 得到
#uid pid ppid c stime tty time cmd
root 13581 1 0 15:13 pts/0 00:00:27 node /usr/bin/gitbook serve
1.2aux参数
# 显示所有包含其他使用者的行程
ps -aux | grep gitbook
# 得到
#user pid %cpu %mem vsz. rss tty stat start time command
root 3861 0.0 0.0 112704 972 pts/0 S+ 09:56 0:00 grep --color=auto gitbook
root 12610 0.0 0.0 113172 4 ? Ss May22 0:00 bash -c cd "/opt/gitbook" && java -jar slave.jar
root 20809 0.0 0.0 113176 1424 ? S May22 0:00 sh/opt/gitbook/gitbook.sh
1.3有了pid可以查看该进程所对应的目录
pwdx 13581
# 得到
13581: /home/irongitbook
也可以查看进程所占用的端口
netstat -anpt | grep 13581
# 得到
tcp6 0 0 :::35729 :::* LISTEN 13581/node
tcp6 0 0 :::4000 :::* LISTEN 13581/node
tcp6 0 0 192.168.0.46:35729 172.16.1.11:57020 ESTABLISHED 13581/node
2.终止进程
# -9是强迫进程立即停止
kill -9 13581