Which terminal command to get just IP address and nothing else?

后端 未结 29 1273
春和景丽
春和景丽 2020-12-04 06:16

I\'m trying to use just the IP address (inet) as a parameter in a script I wrote.

Is there an easy way in a unix terminal to get just the IP address, rather than loo

29条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-04 06:34

    On latest Ubuntu versions (14.04 - 16.04), this command did the trick for me.

    hostname -I | awk '{print $1}'
    

提交回复
热议问题