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
+7.6k Golang : Scan files for certain pattern and rename part of the files
+6.3k Golang : Map within a map example
+17.7k Golang : Put UTF8 text on OpenCV video capture image frame
+7.1k Linux : How to fix Brother HL-1110 printing blank page problem
+11.5k Golang : Verify Linux user password again before executing a program example
+5.2k Golang : What is StructTag and how to get StructTag's value?
+17.5k Golang : Iterate linked list example
+5.6k Unix/Linux : How to open tar.gz file ?
+7k Golang : How to fix html/template : "somefile" is undefined error?
+7.2k Golang : How to stop user from directly running an executable file?
+7.1k Golang : Accessing dataframe-go element by row, column and name example
+10.1k Golang : Simple Jawi(Yawi) to Rumi(Latin/Romanize) converter