If I check with google, I can see my public IP. Is there something on the Ubuntu command-line which will yield me the same answer?
22 Answers
If you are not behind a router, you can find it out using ifconfig
.
If you are behind a router, then your computer will not know about the public IP address as the router does a network address translation. You could ask some website what your public IP address is using curl
or wget
and extract the information you need from it:
curl -s https://checkip.dyndns.org | sed -e 's/.*Current IP Address: //' -e 's/<.*$//'
or shorter
curl https://ipinfo.io/ip
-
32ty - right after I posted, I realized that I didn't google for an answer first: looks like this will work
curl -s checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//'
Other possibilities are listed here: http://www.go2linux.org/what-is-my-public-ip-address-with-linux – kfmfe04 Jan 16 '12 at 12:01 -
If he agrees I could also put this into my answer. However,I am usually against solving the problem for someone, instead I regard also "pointers into a direction" as answer. Users wont understand the context of what they are doing if they are always faced with complete solutions. – Michael K Jan 16 '12 at 12:46
-
1
-
1To clarify: That was a hack, and a very ugly one at that, so I did an edit to make it simpler and something that people can remember. – jrg Jan 16 '12 at 16:17
-
2Exacly as Giovanni P stated. The OP should change the accepted anwser. – loostro Apr 11 '14 at 21:45
-
This worked for me; a quick, correct result. Maybe something changed/changed back. – iynque Aug 31 '15 at 00:08
-
49
-
1Be careful to use proper quoting of variable names if you use the results of these sorts of external services for variables in a script. If one of these services gets hacked it is possible someone could inject dangerous code into your command line. – Code Commander Dec 23 '15 at 21:59
-
1
-
-
I tried both solution and I have different results the first one is correct, the second one it the one from my ISP. – Ahmad Abuhasna Jun 13 '16 at 08:33
-
can you please explain the regular expression
's/<.*$//'
and why do you use twice-e
? – Jas Sep 06 '16 at 07:55 -
-
Looks like ipinfo is requiring a key now. This no longer works quite the same. – flickerfly Jan 24 '19 at 18:52
-
-
As of August 2019, on Ubuntu Server 18.04, the "curl https://ipinfo.io/ip" command works great.
Question -- is there a way to add this to the motd?
– Hoodahmahn Aug 17 '19 at 20:22 -
I want to add this as a note for myself for the next time I google for this answer: you must use curl and not the browser when you have enabled the "Proxy IP Header spoofing" in the Trace chrome/firefox addon. When you enable that setting in the privacy addon, most sites mentioned in answers here fail to show you the real ip, including ipinfo.io! The following ones always returns correct IP address, regardless of the fake proxy headers: https://icanhazip.com, https://ident.me, https://whatismyip.network – Costin Gușă Dec 06 '19 at 11:54
-
-
curl https://ipinfo.io/ip still works fine in Ubuntu 22.04 as of July 2023. – Dr Phil Jul 15 '23 at 00:38
For finding the external ip, you can either use external web-based services, or use system based methods. The easier one is to use the external service, also the ifconfig
based solutions will work in your system only if you're not behind a NAT
. the two methods has been discussed below in detail.
Finding external IP using external services
The easiest way is to use an external service via a commandline browser or download tool. Since wget
is available by default in Ubuntu, we can use that.
To find your ip, use-
$ wget -qO- https://ipecho.net/plain ; echo
Courtesy:
- https://hawknotes.blogspot.in/2010/06/finding-your-external-ip-address.html
- https://ipecho.net/plain
You could also use lynx
(browser) or curl
in place of wget
with minor variations to the above command, to find your external ip.
Using curl
to find the ip:
$ curl https://ipecho.net/plain
For a better formatted output use:
$ curl https://ipecho.net/plain ; echo
A faster (arguably the fastest) method using dig
with OpenDNS
as resolver:
The other answers here all go over HTTP to a remote server. Some of them require parsing of the output, or rely on the User-Agent header to make the server respond in plain text. They also change quite frequently (go down, change their name, put up ads, might change output format etc.).
- The DNS response protocol is standardised (the format will stay compatible).
- Historically DNS services (OpenDNS, Google Public DNS, ..) tend to survive much longer and are more stable, scalable and generally looked after than whatever new hip whatismyip.com HTTP service is hot today.
- (for those geeks that care about micro-optimisation), this method should be inherently faster (be it only by a few micro seconds).
Using dig with OpenDNS as resolver:
$ dig +short myip.opendns.com @resolver1.opendns.com
111.222.333.444
Copied from: https://unix.stackexchange.com/a/81699/14497
Finding external IP without relying on external services
- If you know your network interface name
Type the following in your terminal:
$ LANG=c ifconfig <interface_name> | grep "inet addr" | awk -F: '{print $2}' | awk '{print $1}'
In the above, replace <interface_name>
with the name of your actual interface, e.g: eth0
, eth1
, pp0
, etc...
Example Usage:
$ LANG=c ifconfig ppp0 | grep "inet addr" | awk -F: '{print $2}' | awk '{print $1}'
111.222.333.444
- If you don't know your network interface name
Type the following in your terminal (this gets the name and ip address of every network interface in your system):
$ LANG=c ifconfig | grep -B1 "inet addr" |awk '{ if ( $1 == "inet" ) { print $2 } else if ( $2 == "Link" ) { printf "%s:" ,$1 } }' |awk -F: '{ print $1 ": " $3 }'
Example Usage:
$ LANG=c ifconfig | grep -B1 "inet addr" |awk '{ if ( $1 == "inet" ) { print $2 } else if ( $2 == "Link" ) { printf "%s:" ,$1 } }' |awk -F: '{ print $1 ": " $3 }'
lo: 127.0.0.1
ppp0: 111.222.333.444
N.B: Outputs are indicative and not real.
Courtesy: https://www.if-not-true-then-false.com/2010/linux-get-ip-address/
UPDATE
LANG=c
has been added toifconfig
based usages, so that it always gives the english output, irrespective of locale setting.
-
1@Z9iT, Sure.. It should work in any linux distribution provided that you have wget installed. As said if you have either curl or lynx already available please use that instead. You would need root permission to install so use
sudo apt-get install wget
– saji89 Jun 01 '12 at 12:19 -
16The commands with ifconfig do only work, if you are not behind a NAT. – lukassteiner Jan 23 '13 at 15:52
-
3
-
3This proposal using dig is pretty nice http://unix.stackexchange.com/questions/22615/how-can-i-get-my-external-ip-address-in-bash – binaryanomaly Mar 14 '15 at 15:31
-
-
1@saji
ifconfig
if obsolete, please useiproute2
;^). The command would beip -o -4 a s eth0 | awk '{sub(/\/.*/, "", $4);print $4}'
. – bufh Jun 11 '15 at 21:28 -
-
-
6The last version without external services only works, if your computer is connected directly to the internet which is rarely the case, otherwise you only get your local IP address. – rubo77 Oct 05 '15 at 02:42
-
1If you'd like to retrieve your IP address into a notification you could use:
notify-send $(dig +short myip.opendns.com @resolver1.opendns.com)
which is something I use as a bound application in kubuntu – Jonathan Mar 07 '17 at 19:18 -
Custom
getip
command is super-fast using Google resolvers:alias getip="echo My WAN/Public IP: $(dig TXT +short o-o.myaddr.l.google.com @ns1.google.com | sed 's/\"//g')"
.time (getip)
finishes in under 0.00s – rishimaharaj Nov 26 '20 at 00:12 -
On recent
ubuntu
/debian
one has togrep
forinet
and notinet addr
to get the (local) ip. – Timo May 15 '21 at 06:56 -
Can't answer, but the best solution , that even handles multiple internal gateway hops is:
- traceroute to 8.8.8.8 for example, extract the first non-local network you find. That will be your public gateway on the ISP network.
- ping with -R to get the sources and also find the first non-public network. That's your public IP.
Have a script that does everything but can't answer.
– FrameGrace Aug 26 '21 at 10:35
My favorite has always been :
curl ifconfig.me
simple, easy to type.
You will have to install curl first ;)
If ifconfig.me is down try icanhazip.com and or ipecho.net
curl icanhazip.com
or
curl ipecho.net

- 102,067
-
-
3@Z9iT, I just checked this now. Yes, it would output the external ip in your terminal. – saji89 Jun 01 '12 at 13:13
-
7The response time from
ifconfig.me
seems quite a bit slower thanipecho.net
. – Drew Noakes Oct 25 '13 at 14:57 -
3If you don't have
curl
but havewget
:wget -U curl -qO- ifconfig.me
– Stéphane Chazelas Aug 14 '14 at 20:16 -
-
2
-
1@AsfandYarQazi - working here. You can try one of the alternates , icanhazip.com – Panther Jan 20 '16 at 12:48
-
@bodhi.zazen ipconfig.me seams to be down. Please update your response with some other url that works. – valentt Sep 20 '16 at 09:50
-
@valentt ifconfig.me is up here, if it is not working for you try ipecho.net and icanhazip.com – Panther Sep 20 '16 at 16:38
-
-
@prayagupd - This answer is 5 years old and ifconfig.me goes up and down. Use another site icanhazip.com for example, second example still works. – Panther May 24 '17 at 18:11
-
Thanks @bodhi.zazen
curl icanhazip.com
orcurl http://checkip.amazonaws.com
(on aws at least) was working. – prayagupa May 24 '17 at 18:13 -
-
-
It's probably best to stick to services that are actually meant (and documented) to be used like that. For example, I cannot find any docs on checkip.amazonaws.com so it's not clear who runs the service or what it will do in the future. icanhazip.com is probably a good choice, it is run by Cloudflare now: https://major.io/2021/06/06/a-new-future-for-icanhazip/ – Dario Seidl Apr 16 '22 at 19:08
icanhazip.com is my favorite.
curl icanhazip.com
You can request IPv4 explicitly:
curl ipv4.icanhazip.com
If you don't have curl
you can use wget
instead:
wget -qO- icanhazip.com

- 893
-
Thanks! I had to try many suggested above until I found some that is IPv6-capable. It's a shame that such services are usually still IPv4-only. – Vladimír Čunát Feb 24 '19 at 17:20
-
This seems to be a good choice, it is run by CloudFlare now: https://major.io/2021/06/06/a-new-future-for-icanhazip/ – Dario Seidl Apr 16 '22 at 19:08
Running my own service, designed to be simple and stupid, ident.me.
Its API and implementation are documented at https://api.ident.me/
Examples from the terminal (add https://
for security at the expense of speed):
curl ident.me
curl v4.ident.me
curl v6.ident.me

- 1,205
- 10
- 11
-
1
-
1I find the icanhazip.com solution faster and it includes a newline in the output. – Tyler Collier Aug 19 '14 at 00:00
-
1
-
3Kudos! 2 years and you are still maintaining it. Well done. "IDENTify ME", is what comes to my mind, when I need ip check :) – Mohnish Sep 28 '15 at 01:37
-
2aws is faster
time curl http://checkip.amazonaws.com
->0.91s
vs.241s
forident.me
Let's just pray aws doesnt go down ;) – Avindra Goolcharan Apr 12 '18 at 01:41 -
@AvindraGoolcharan - you DO realize that 0.91s is greater than 0.241, right? Which would make AWS slower. https://bit.ly/2nLGSKb – Robear May 05 '18 at 02:08
-
1@Robear I meant
.091
. No need to be facetious with your Khan link – Avindra Goolcharan May 06 '18 at 02:35 -
-
-
Added DNS and SSH support, would love to cover more grounds if anybody has suggestions. @AvindraGoolcharan please don't pray, build redundancy :) – Pierre Carrier Feb 26 '22 at 18:06
You could use a DNS request instead of HTTP request to find out your public IP:
$ dig +short myip.opendns.com @resolver1.opendns.com
It uses resolver1.opendns.com
dns server to resolve the magical myip.opendns.com
hostname to your ip address.

- 4,008
-
3This is really fast. I did one warmup execution, then 10 executions each of this and
curl icanhazip.com
. Average for thecurl
version: 174ms. Average for the DNS-only version: 9ms. ~19x faster. See also: http://unix.stackexchange.com/a/81699/8383 – Adam Monsen Mar 10 '15 at 21:06 -
1@AdamMonsen Thank you for the link. The point of using DNS (as the answer that you've linked says) is that the response is standard (and unlikely to change) and the service (OpenDNS) might stick around longer than most of its http alternatives. The time it takes to make the request might be shadowed by the command start up time. – jfs Mar 11 '15 at 00:40
-
1Yep. I wouldn't be surprised if
curl
itself is slower thandig
. Even if they were rewritten to be as similar as possible,curl
would still be slower; it uses HTTP (including DNS) anddig
only uses DNS. – Adam Monsen Mar 11 '15 at 04:16
Amazon AWS
curl https://checkip.amazonaws.com
Sample output:
123.123.123.123
Also works on browser: http://checkip.amazonaws.com
I like it because:
- it returns just the plaintext IP in the reply body, nothing else
- it is from a well known provider which is unlikely to go offline anytime soon

- 28,474
-
1Was looking for solution with some known name, thank you – Manohar Reddy Poreddy Nov 10 '19 at 02:41
The one i'm using is :
wget -O - -q icanhazip.com
Yes, you can have ip :-)

- 600
-
3I prefer
curl icanhazip.com
sometimeswget
is the only one available, but sometimes nowget
is available as well andcurl
is your only option (like OS/X). Either waycurl icanhazip.com
is almost as easy ascurl ifconfig.me
but much funnier ;-) – TryTryAgain Aug 25 '12 at 20:38
For this, STUN was invented. As a client you can send a request to a publicly available STUN server and have it give back the IP address it sees. Sort of the low level whatismyip.com as it uses no HTTP and no smartly crafted DNS servers but the blazingly fast STUN protocol.
Using stunclient
If you have stunclient
installed (apt-get install stuntman-client
on debian/ubuntu) you can simply do:
$stunclient stun.services.mozilla.com
Binding test: success
Local address: A.B.C.D:42541
Mapped address: W.X.Y.Z:42541
where A.B.C.D
is the IP address of your machine on the local net and W.X.Y.Z
is the IP address servers like websites see from the outside (and the one you are looking for). Using sed
you can reduce the output above to only an IP address:
stunclient stun.services.mozilla.com |
sed -n -e "s/^Mapped address: \(.*\):.*$/\1/p"
However, your question was how to find it using the command line, which might exclude using a STUN client. So I wonder...
Using bash
A STUN request can be handcrafted, sent to an external STUN server using netcat
and be post-processed using dd
, hexdump
and sed
like so:
$echo -en '\x00\x01\x00\x08\xc0\x0c\xee\x42\x7c\x20\x25\xa3\x3f\x0f\xa1\x7f\xfd\x7f\x00\x00\x00\x03\x00\x04\x00\x00\x00\x00' |
nc -u -w 2 stun.services.mozilla.com 3478 |
dd bs=1 count=4 skip=28 2>/dev/null |
hexdump -e '1/1 "%u."' |
sed 's/\.$/\n/'
The echo defines a binary STUN request (0x0001 indicates Binding Request) having length 8 (0x0008) with cookie 0xc00cee and some pasted stuff from wireshark. Only the four bytes representing the external IP are taken from the answer, cleaned and printed.
Working, but not recommended for production use :-)
P.S. Many STUN servers are available as it is a core technology for SIP and WebRTC. Using one from Mozilla should be safe privacy-wise but you could also use another: STUN server list

- 291
-
2+1 for the geekiest and actually most apropos technology. The http query works, which is what I've been using all my life, but I like that there's actually been some thought put into the question. I didn't know this. Thanks! – Mike S Oct 18 '16 at 17:47
-
1
-
1
-
Type in this exactly, press Enter where indicated:
telnet ipecho.net 80
Enter
GET /plain HTTP/1.1
Enter
HOST: ipecho.net
Enter
BROWSER: web-kit
Enter
Enter
This manually submits a HTTP request, which will return your IP at the bottom of a HTTP/1.1 200 OK reply
Example output:
$ telnet ipecho.net 80
Trying 146.255.36.1...
Connected to ipecho.net.
Escape character is '^]'.
GET /plain HTTP/1.1
HOST: ipecho.net
BROWSER: web-kit
HTTP/1.1 200 OK
Date: Tue, 02 Jul 2013 07:11:42 GMT
Server: Apache
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Cache-Control: no-cache
Pragma: no-cache
Vary: Accept-Encoding
Transfer-Encoding: chunked
Content-Type: text/html
f
111.222.333.444
0
-
6Nice, this worked well, not having to install curl was an advantage for me: one liner: printf "GET /plain HTTP/1.1\nHOST: ipecho.net\nBROWSER: web-kit\n\n" | nc ipecho.net 80 – Ozone Mar 19 '14 at 05:32
You can read a web page using only bash, without curl
, wget
:
$ exec 3<> /dev/tcp/icanhazip.com/80 && # open connection
echo 'GET /' >&3 && # send http 0.9 request
read -u 3 && echo $REPLY && # read response
exec 3>&- # close fd

- 4,008
-
This combined with
checkip.amazonaws.com
is the fastest for me – Avindra Goolcharan Apr 12 '18 at 01:44 -
1
-
This answer is poetry to me. So elegant, and so cool to do it only using
bash
. Bravo and +1 – bballdave025 Apr 22 '23 at 19:48
I have a stupid service for this by telnet. Something like this:
telnet myip.gelma.net
Your IPv4: xxx.xxx.xxx.xxx
Your IPv6: ::ffff:xxxx:xxxx
Feel free to use it.
-
It prints:
Trying 2600:3c03::f03c:91ff:fe96:cc28...
andtelnet: Unable to connect to remote host: Network is unreachable
– WinEunuuchs2Unix Jul 23 '21 at 17:56 -
Unreachable here too -- it appears gelma.net may no longer be offering this service in 2022 (or may be using a different method now) – Jeff Clayton Aug 11 '22 at 13:45
These will get the local IPs:
ifconfig
or for shorter output:
ifconfig | grep inet
also
ip addr show
and probably:
hostname -I
This should get the external IP
wget http://smart-ip.net/myip -O - -q ; echo
N.B. If you don't mind to installing curl
, this as well:
curl http://smart-ip.net/myip

- 30,194
- 17
- 108
- 164
-
1
ifconfig | sed -nre '/^[^ ]+/{N;s/^([^ ]+).*addr: *([^ ]+).*/\1,\2/p}'
will print the local interfaces and corresponding V4 IP's – Hannu Jun 27 '14 at 18:09 -
1
ifconfig | sed -nre '/^[^ ]+/{N;N;s/^([^ ]+).*addr: *([^ ]+).*addr: *([^ ]+).*/\1,\2,\3/p}'
- v4 and v6 IPs. – Hannu Jun 27 '14 at 18:15
For those of us with login access to our routers, using a script to ask the router what its' WAN IP address is is the most efficient way to determine the external IP address. For instance the following python script prints out the external IP for my Medialink MWN-WAPR300N router:
import urllib, urllib2, cookielib
import re
from subprocess import check_output as co
cookie_jar = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookie_jar))
urllib2.install_opener(opener)
def get(url, values=None):
data = None
if values: data = urllib.urlencode(values)
req = urllib2.Request(url, data)
rsp = urllib2.urlopen(req)
return rsp.read()
router = co(['ip', '-o', 'ro', 'list', '0.0.0.0/0']).split()[2]
url = "http://" + router
get(url+"/index.asp")
get(url+"/LoginCheck", dict(checkEn='0', Username='admin', Password='admin'))
page = get(url+"/system_status.asp")
for line in page.split("\n"):
if line.startswith("wanIP = "):
print line.split('"')[1]
exit(1)
Note that this is not very secure (as is the case with plaintext credentials & logging in to most routers), and is certainly not portable (needs to be changed for each router). It is however very fast and a perfectly reasonable solution on a physically secure home network.
To customize the script for another router, I recommend using the tamperdata addon in firefox to determine what HTTP requests to make.

- 178
- 9
-
2You should try getting the IP address of the router grammatically. For example
router = subprocess.check_output(['ip', '-o', 'ro', 'list', '0.0.0.0/0']).split()[2]
. – Cristian Ciupitu Jun 02 '14 at 02:26
Many home routers can be queried by UPnP:
curl "http://fritz.box:49000/igdupnp/control/WANIPConn1" -H "Content-Type: text/xml; charset="utf-8"" -H "SoapAction:urn:schemas-upnp-org:service:WANIPConnection:1#GetExternalIPAddress" -d "<?xml version='1.0' encoding='utf-8'?> <s:Envelope s:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:s='http://schemas.xmlsoap.org/soap/envelope/'> <s:Body> <u:GetExternalIPAddress xmlns:u='urn:schemas-upnp-org:service:WANIPConnection:1' /> </s:Body> </s:Envelope>" -s
Then, grep the ip address from the answer.
grep -Eo '\<[[:digit:]]{1,3}(\.[[:digit:]]{1,3}){3}\>'
If you are using DD-WRT then this works for me:
curl -s 192.168.1.1 | grep "ipinfo" | awk -v FS="(IP: |</span)" '{print $2}'
or
curl -s -u your_ddwrt_username:your_ddwrt_password http://192.168.1.1 | grep "ipinfo" | awk -v FS="(IP: |</span)" '{print $2}'
Where 192.168.1.1 is the Gateway/Router LAN IP Address of the DD-WRT router.
The -s component means silent (i.e. don't show the curl progress information).
- Oh, I should mention that I use the above with "DD-WRT v24-sp2 (01/04/15) std".

- 191
- 1
- 3
Maybe I am a little late, but inxi can do it fairly easy.
Install inxi
sudo apt install inxi
Then run the following command
inxi -i
Example with my information blocked out using the z
option for copy and paste to sites like this:
~$ inxi -iz
Network: Card: NVIDIA MCP77 Ethernet driver: forcedeth
IF: eth0 state: up speed: 1000 Mbps duplex: full mac: <filter>
WAN IP: <filter>
IF: eth0 ip-v4: <filter> ip-v6-link: N/A
Where it says <filter>
is where your WAN IP, IPv4, MAC address etc will appear

- 41,612
- 7
- 124
- 183
-
Although not the fastest, it is the prettiest with color output. – WinEunuuchs2Unix Jul 23 '21 at 18:01
-
-
@FrameGrace So, what's your point? Most of these answers here are using external ways to get your Public IP. If I really wanted to use 100% local my command with my OpenWRT router is
ssh root@10.0.0.1 'ip addr show pppoe-wan' | awk '/inet/ {print $2}'
, but my command won't work for everyone else here. – Terrance Aug 26 '21 at 13:06
use ip
!
ip addr show
then look for the relevant adapter (not lo
, and usually eth0
), and locate the ip address near inet
.

- 1,205
- 18
- 36
-
4
-
1this works on our company servers -- if you do: ip addr show | grep inet (grep not absolutely required but better for output) you will get all ip addresses, local and external (including inet 6 protocol) - our servers are using CENTOS if your server does not somehow have the ip command. Similar output to: ifconfig | grep inet – Jeff Clayton Aug 11 '22 at 13:48
Simply issue a traceroute for any website or service..
sudo traceroute -I google.com
Line 2 always seems to be my public IP address after it gets past my router gateway.
user@user-PC ~ $ sudo traceroute -I google.com
traceroute to google.com (173.194.46.104), 30 hops max, 60 byte packets
1 25.0.8.1 (25.0.8.1) 230.739 ms 231.416 ms 237.819 ms
2 199.21.149.1 (199.21.149.1) 249.136 ms 250.754 ms 253.994 ms**
So, make a bash command.
sudo traceroute -I google.com | awk -F '[ ]' '{ if ( $2 ="2" ) { print $5 } }'
And the output...
(199.21.149.1)
I don't think relying on PHP scripts and the sort is good practice.

- 592
-
this is interesting, though really slow and doesn't get my external ip like this – rubo77 Oct 05 '15 at 02:46
-
1This answer is too inaccurate to be useful. In my corporate environment I don't get my IP address at all. The only way it works is if you understand how your local routers and switches are crafted, and even then it may not be on line 2 depending on the number of local hops you jump through. There's no way to make a coherent algorithm out of this technique, and there are many other solutions here that are simpler and will get you the proper answer every time. – Mike S Oct 18 '16 at 17:52
-
While it may work in some special configurations, I have actually never seen my external IP in a traceroute. It is usually either my gateway (if I am not behind NAT), or my router's gateway, but mostly some other router further away. – mivk Feb 14 '17 at 11:52
-
A command with no dependencies except 8.8.8.8 being a GOogle DNS:
echo $(ip route get 8.8.8.8 | awk '{print $NF; exit}')

- 635
-
-
the command does show the public ip address if I run it on a cloud server. wasn;t that the question? – Rolf Sep 17 '15 at 20:48
-
-
I am using a CENTOS server hosted by a remote company, and this works just fine on the command line. – Jeff Clayton Aug 11 '22 at 13:56
notify-send
. – PJ Brunet Dec 02 '16 at 19:36ifconfig eth1 | sed -nre '/^[^ ]+/{N;s/^([^ ]+).*inet *([^ ]+).*/\2/p}'
where eth1 is the network device o interest, you can omit the 'et1' string to show all ips of all adapters. Instead of\2
you can write\1 \2
to show the names of each adapter too. – Hafenkranich Oct 27 '18 at 12:28$ hostname --ip-address
– Leo Dabus Jun 28 '21 at 00:44