• Linux查找进程及端口占用


    Windows的命令是: netstat -ano | findstr "80" (注80是你想要看查看的端口号)

    Linux:

    法1:

    ps aux | grep httpd

    netstat -anp | grep httpd

    法2:

    ps -ef | grep httpd

    netstat -tunpl  | grep httpd

    #######################

    附:

    [root@bogon bin]# ps --help
    ********* simple selection *********  ********* selection by list *********
    -A all processes                      -C by command name
    -N negate selection                   -G by real group ID (supports names)
    -a all w/ tty except session leaders  -U by real user ID (supports names)
    -d all except session leaders         -g by session OR by effective group name
    -e all processes                      -p by process ID
    T  all processes on this terminal     -s processes in the sessions given
    a  all w/ tty, including other users  -t by tty
    g  OBSOLETE -- DO NOT USE             -u by effective user ID (supports names)
    r  only running processes             U  processes for specified users
    x  processes w/o controlling ttys     t  by tty
    *********** output format **********  *********** long options ***********
    -o,o user-defined  -f full            --Group --User --pid --cols --ppid
    -j,j job control   s  signal          --group --user --sid --rows --info
    -O,O preloaded -o  v  virtual memory  --cumulative --format --deselect
    -l,l long          u  user-oriented   --sort --tty --forest --version
    -F   extra full    X  registers       --heading --no-heading --context
                        ********* misc options *********
    -V,V  show version      L  list format codes  f  ASCII art forest
    -m,m,-L,-T,H  threads   S  children in sum    -y change -l format
    -M,Z  security data     c  true command name  -c scheduling class
    -w,w  wide output       n  numeric WCHAN,UID  -H process hierarchy
    [root@bogon bin]# netstat --help
    usage: netstat [-veenNcCF] [<Af>] -r         netstat {-V|--version|-h|--help}
           netstat [-vnNcaeol] [<Socket> ...]
           netstat { [-veenNac] -I[<Iface>] | [-veenNac] -i | [-cnNe] -M | -s } [delay]
    
            -r, --route                display routing table
            -I, --interfaces=<Iface>   display interface table for <Iface>
            -i, --interfaces           display interface table
            -g, --groups               display multicast group memberships
            -s, --statistics           display networking statistics (like SNMP)
            -M, --masquerade           display masqueraded connections
    
            -v, --verbose              be verbose
            -n, --numeric              don't resolve names
            --numeric-hosts            don't resolve host names
            --numeric-ports            don't resolve port names
            --numeric-users            don't resolve user names
            -N, --symbolic             resolve hardware names
            -e, --extend               display other/more information
            -p, --programs             display PID/Program name for sockets
            -c, --continuous           continuous listing
    
            -l, --listening            display listening server sockets
            -a, --all, --listening     display all sockets (default: connected)
            -o, --timers               display timers
            -F, --fib                  display Forwarding Information Base (default)
            -C, --cache                display routing cache instead of FIB
            -T, --notrim               stop trimming long addresses
            -Z, --context              display SELinux security context for sockets
    
      <Iface>: Name of interface to monitor/list.
      <Socket>={-t|--tcp} {-u|--udp} {-S|--sctp} {-w|--raw} {-x|--unix} --ax25 --ipx --netrom
      <AF>=Use '-A <af>' or '--<af>'; default: inet
      List of possible address families (which support routing):
        inet (DARPA Internet) inet6 (IPv6) ax25 (AMPR AX.25) 
        netrom (AMPR NET/ROM) ipx (Novell IPX) ddp (Appletalk DDP) 
        x25 (CCITT X.25) 
    
  • 相关阅读:
    洛谷 P1396 营救(二分答案)
    洛谷 P1807 最长路(toposort)
    洛谷 P1137 旅行计划(toposort)
    [bzoj3032][TYVJ P1924]七夕祭(环形均分纸牌,货仓选址)
    BZOJ3043 IncDec Sequence (差分)
    BZOJ2200 道路与航线(dijk+拓扑排序)
    P1462 通往奥格瑞玛的道路(二分+dijkstra)
    P1020 导弹拦截 O(nlogn)做法
    背包整理(01背包,完全背包,多重背包,分组背包)(待更新)
    [模板]树链剖分
  • 原文地址:https://www.cnblogs.com/wucg/p/3033391.html
Copyright © 2020-2023  润新知