5

This question already has an answer here:

I already figured out that on Linux I can list network devices

(cd /proc/net/dev_snmp6/ && for device in *; do echo $device; done|sort)

but how can I get the ipv4 address of the device?

I do not have ifconfig/ip installed - and I'd like to keep it this way.

marked as duplicate by GAD3R, Thomas, Rui F Ribeiro linux Dec 16 '18 at 21:16

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • basically net-tools are not installed and i want to just "standard" unix tools, like cat / sed/ awk /bash – Mandragor Feb 16 '17 at 19:12
  • See this answer : unix.stackexchange.com/a/48315/153195 – GAD3R Dec 16 '18 at 10:33
  • @GAD3R, Thomas, Rui F Riberio: I think you all misread the question. You've linked a completely unrelated question while marking dup. Here's a better one with answers in bash, python, and C: stackoverflow.com/q/5281341/141023 – cheshirekow Feb 11 at 19:12
0

Using netstat -ie you should be able to see all interfaces and any information associated with them.

Example:

user@host:~$ netstat -ie
Kernel Interface table

eth0      Link encap:Ethernet  HWaddr 00:16:3e:09:da:c8  
          inet addr:43.96.21.119  Bcast:43.96.21.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:63671638 errors:0 dropped:0 overruns:0 frame:0
          TX packets:48175503 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:12361708203 (12.3 GB)  TX bytes:12765881974 (12.7 GB)
  • thanks for pointing out netstat, but this is also part of the net-tools which are not installed (ifconfig etc.) – Mandragor Feb 16 '17 at 19:12

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