Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Currently, when using the ifconfig command, the following IP addresses are shown: own IP, broadcast and mask.

Is there a way to show the related gateway IP address as well (on the same screen with all the others, not by using 'route' command)?

share|improve this question
The addresses shows are parameters of the IP configuration of the interface. The gateway is a system routing parameter, not an interface parameter. It wouldn't make sense to show it in the interface configuration. –  David Schwartz Oct 27 '11 at 10:33

2 Answers 2

up vote 15 down vote accepted

You can with the ip command, and given that ifconfig is in the process of being deprecated by most distributions it's now the preferred tool. An example:

$ ip route show dev eth0  proto kernel  scope link  src
default via dev eth0
share|improve this answer
also we can use ip r which shows the same. –  Rahul Patil Jul 31 '13 at 11:50

No, there isn't. According to the man page you can't modify the output of ifconfig (except showing disabled interfaces, too).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.