Unix/Linux : How to get own IP address ?
I know I know... this should be a fairly simple task.. but my memory is that good anymore.
Just a note to myself. This is how to get own IP address on Unix/Linux
First with :
ifconfig
eth0 Link encap:Ethernet HWaddr 04:01:12:F0:61:01
inet addr:162.243.5.230 Bcast:162.243.5.255 Mask:255.255.255.0 <------- HERE !
inet6 addr: fe80::601:12ff:fef0:6101/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:12844262 errors:0 dropped:0 overruns:0 frame:0
TX packets:1945153 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1256605981 (1.1 GiB) TX bytes:5305072100 (4.9 GiB)
or
hostname -I
(capital i)162.243.5.230 10.128.221.78 <----------------------first from left is the IP address
By Adam Ng
IF you gain some knowledge or the information here solved your programming problem. Please consider donating to the less fortunate or some charities that you like. Apart from donation, planting trees, volunteering or reducing your carbon footprint will be great too.
Advertisement
Tutorials
+11.5k SSL : The certificate is not trusted because no issuer chain was provided
+8.9k Golang : Get curl -I or head data from URL example
+20k Golang : Count number of digits from given integer value
+12.4k Golang : HTTP response JSON encoded data
+20.9k Golang : For loop continue,break and range
+19.4k Golang : Get current URL example
+17.4k Golang : Find smallest number in array
+14.6k Golang : Get URI segments by number and assign as variable example
+10.8k Golang : Create Temporary File
+6.5k Golang : How to determine if request or crawl is from Google robots
+8.9k Golang : Inject/embed Javascript before sending out to browser example
+10.2k Golang : cannot assign type int to value (type uint8) in range error