What shell command supplies IP address ?
I don't know what shell command line supplies IP address ? Please tell me !
|
Hi shakersort,
If you want to know the IP address of the machine that you are using, run Quote:
Theorist |
Quote:
or /sbin/ip addr anc@orac:~> /bin/ip addr 1: lo: <LOOPBACK,UP> mtu 16436 qdisc noqueue link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000 link/ether 00:0e:a6:8c:f3:16 brd ff:ff:ff:ff:ff:ff inet 192.168.254.197/24 brd 192.168.254.255 scope global eth0 inet6 fe80::20e:a6ff:fe8c:f316/64 scope link valid_lft forever preferred_lft forever 3: sit0: <NOARP> mtu 1480 qdisc noop link/sit 0.0.0.0 brd 0.0.0.0 |
You can spell it out instead of abbreviating too. So to find your ip address at the command line you type ip address at the command line. Damn that's just too easy! Why can't Windows be so simple? LOL :o :p
[climber@blackhole ~]$ ip address 1: lo: <LOOPBACK,UP,10000> mtu 16436 qdisc noqueue link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: dev11254: <BROADCAST,MULTICAST> mtu 1500 qdisc noop qlen 1000 link/ether 00:c1:ff:3a:b3:8e brd ff:ff:ff:ff:ff:ff 3: eth0: <BROADCAST,MULTICAST,UP,10000> mtu 1500 qdisc pfifo_fast qlen 1000 link/ether 00:a3:4e:ef:7b:a1 brd ff:ff:ff:ff:ff:ff inet 192.168.1.100/24 brd 192.168.1.255 scope global eth0 inet6 fe80::214:2aff:fe1f:9c14/64 scope link valid_lft forever preferred_lft forever 4: sit0: <NOARP> mtu 1480 qdisc noop link/sit 0.0.0.0 brd 0.0.0.0 |
Quote:
|
If you just want the IP address of eth0 and nothing else (for example to use in a variable or script) you can use this:
Code:
ifconfig eth0 | grep "inet addr:" | awk -F: {'print $2'} | cut -d\ -f 1 |
this is also the completely wrong forum for this question- I've reported it to the moderators so it can be moved to a better place. (to help other people with the problem find it easily)
titanium_geek EDIT - apologies for harsh sounding tone. added a :) to make it feel happier. |
Quote:
|
Moved: This thread is more suitable in Linux - Newbie and has been moved accordingly to help your thread/question get the exposure it deserves.
--jeremy |
All times are GMT -5. The time now is 06:23 AM. |