linux 命令: 网络和进程

 

 

 

  •  netstat: 显示各种网络相关信息,如网络连接,路由表,接口状态(interface statistics), masquerade连接, 多播(Multicast memberships) 
[krystal@localhost ~]$ netstat -plte |grep node
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       User       Inode      PID/Program name    
tcp       12      0 0.0.0.0:hbci            0.0.0.0:*               LISTEN      krystal    72645      6042/node 
  •  pmap: 用进程名字的某个关键字查看其内存使用情况
[krystal@localhost ~]$ pmap -x `ps aux|grep <keyword>|grep -v grep |awk '{print $2}'`
  •  hostname, ifconfig 查看IP地址
[krystal@localhost ~]$ hostname -i
127.0.0.1
[krystal@localhost ~]$ hostname -I
172.18.7.187 172.18.58.176 
[krystal@localhost ~]$ type -a ifconfig
ifconfig is /usr/sbin/ifconfig
ifconfig is /sbin/ifconfig
[krystal@localhost ~]$ ifconfig 
cscotun0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST>  mtu 1418
        inet 172.18.58.176  netmask 255.255.255.0  destination 172.18.58.176
        inet6 fe80::3269:22d7:49c8:bb2d  prefixlen 128  scopeid 0x20<link>
        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 500  (UNSPEC)
        RX packets 2546400  bytes 3388984490 (3.1 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1548200  bytes 110027828 (104.9 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.18.7.187  netmask 255.255.255.128  broadcast 172.18.7.255
        inet6 fe80::b283:feff:fe71:9c84  prefixlen 64  scopeid 0x20<link>
        ether b0:83:fe:71:9c:84  txqueuelen 1000  (Ethernet)
        RX packets 2640036  bytes 3638323089 (3.3 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1571692  bytes 265345047 (253.0 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 788917  bytes 394579953 (376.3 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 788917  bytes 394579953 (376.3 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

4. ip 查看网络信息

[krystal@localhost ~]$ ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether b0:83:fe:71:9c:84 brd ff:ff:ff:ff:ff:ff
    inet 172.18.7.187/25 brd 172.18.7.255 scope global dynamic enp2s0
       valid_lft 43060sec preferred_lft 43060sec
    inet6 fe80::b283:feff:fe71:9c84/64 scope link 
       valid_lft forever preferred_lft forever
4: cscotun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1418 qdisc pfifo_fast state UNKNOWN group default qlen 500
    link/none 
    inet 172.18.58.176/24 brd 172.18.58.255 scope global cscotun0
       valid_lft forever preferred_lft forever
    inet6 fe80::3269:22d7:49c8:bb2d/128 scope link 
       valid_lft forever preferred_lft forever
[krystal@localhost ~]$ ip addr show enp2s0
2: enp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether b0:83:fe:71:9c:84 brd ff:ff:ff:ff:ff:ff
    inet 172.18.7.187/25 brd 172.18.7.255 scope global dynamic enp2s0
       valid_lft 43052sec preferred_lft 43052sec
    inet6 fe80::b283:feff:fe71:9c84/64 scope link 
       valid_lft forever preferred_lft forever

 

转载于:https://www.cnblogs.com/joshuajiang/p/4606199.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值