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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值