zoukankan      html  css  js  c++  java
  • linux查看端口和进程

    查看进程

    ps -aux | grep appname

    杀死进程

    kill pid

    查看端口:

    netstat -ap | grep 端口号

    netstat -ap | grep 进程名字

       lsof -i:端口号

    例子:server这个程序会开启8888这个端口。

    root@ubuntu:/mnt/hgfs/code/SVN/net_code/dd# ./server &
    [1] 3779
    root@ubuntu:/mnt/hgfs/code/SVN/net_code/dd# netstat -ap | grep 8888
    tcp 0 0 localhost:8888 *:* LISTEN 3779/server
    root@ubuntu:/mnt/hgfs/code/SVN/net_code/dd# netstat -ap | grep server
    tcp 0 0 localhost:8888 *:* LISTEN 3779/server
    unix 3 [ ] 流 已连接 23278 3779/server
    unix 3 [ ] 流 已连接 23277 3779/server

    root@ubuntu:/mnt/hgfs/code/SVN/net_code/dd# lsof -i:8888
    COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
    server 3779 root 3u IPv4 23688 0t0 TCP localhost:8888 (LISTEN)


    root@ubuntu:/mnt/hgfs/code/SVN/net_code/dd# kill 3779
    [1]+ 已终止 ./server
    root@ubuntu:/mnt/hgfs/code/SVN/net_code/dd# netstat -ap | grep server

     

  • 相关阅读:
    [bzoj1089] 严格n元树
    [bzoj1097] 旅游景点atr
    [hdu3887] Counting Offspring
    [POJ3321] Apple Tree
    [POJ3635] Full Tank?
    git
    【MySQL】数据的导出导入
    Ubuntu python 开发环境配置
    测试markdown
    约瑟夫环问题-java实现
  • 原文地址:https://www.cnblogs.com/mylinux/p/5200712.html
Copyright © 2011-2022 走看看