• 查看对应端口的程序目录命令-Mac lsof && Linux pwdx


    Linux

      lsof -i:{$port}
      pwdx {$pid}

    [user@hostname ~]$ lsof -i:8080
    COMMAND   PID USER   FD   TYPE    DEVICE SIZE/OFF NODE NAME
    xxxxxx 2747 user    8u  IPv4 930730699      0t0  TCP *:web (LISTEN)
    [user@hostname ~]$  pwdx 2747
    2747: /ssd1/webroot
    

    Mac

      lsof -i:{$port}

      lsof -a -p {$pid} -d txt -Fn | cut -c2- | grep -E "(S|w|s)*.app(S|w|s)*.[a-zA-Z]*" -v | grep -E "(S|w|s)*.[a-zA-Z]{1,6}$" -v | grep app

      lsof -a -p {$pid} -d cwd -Fn | cut -c2- | grep -v {$pid}

    
    
    ➜  lsof -i:80
    COMMAND   PID   USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
    WeChat  35377 user   32u  IPv6 0xcd806161671b7807      0t0  TCP 1.x.x.x:60583->2.x.x.x:http (ESTABLISHED)
    ➜  lsof -a -p 35377 -d txt -Fn | cut -c2- | grep -E "(S|w|s)*.app(S|w|s)*.[a-zA-Z]*" -v | grep -E "(S|w|s)*.[a-zA-Z]{1,6}$" -v | grep app
    
    /Applications/WeChat.app/Contents/MacOS/WeChat
    /Users/user/Library/Containers/com.tencent.xinWeChat/Data/Documents/MMappedKV/mmkv.default
    /Users/user/Library/Containers/com.tencent.xinWeChat/Data/Documents/MMappedKV/maycrashcpmap_v2
    /Users/user/Library/Containers/com.tencent.xinWeChat/Data/Documents/MMappedKV/0.mmkv.default
    /Users/user/Library/Containers/com.tencent.xinWeChat/Data/Documents/MMappedKV/hascrashcpmap_v2
    

    Copyright © 2021 Primzahl. All rights reserved.

  • 相关阅读:
    Spring IoC详解
    Hibernate 和Mybatis的区别
    Nand Flash 驱动框架
    Nor Flash 驱动框架
    USB驱动框架
    输入子系统框架
    module_init 内核调用过程
    平台设备驱动框架
    LCD驱动框架
    嵌入式-开篇
  • 原文地址:https://www.cnblogs.com/Primzahl/p/12420105.html
Copyright © 2020-2023  润新知