Parse ifconfig to get only my IP address using Bash

后端 未结 20 1215
甜味超标
甜味超标 2020-11-30 05:04

I want to edit the bashrc file to have a simple function called \"myip\" to run. As you might guess, the function myip prints only my internal IP address of my machine.

20条回答
  •  -上瘾入骨i
    2020-11-30 05:36

    Use:

    ifconfig enops3 | greb broadcast | cut -d " " -f10
    

    Where enops3 is the interface name.

提交回复
热议问题