Skip to content

Instantly share code, notes, and snippets.

@johan149
Last active January 25, 2023 07:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johan149/0598c69f193f34058cf77fa3c3b68551 to your computer and use it in GitHub Desktop.
Save johan149/0598c69f193f34058cf77fa3c3b68551 to your computer and use it in GitHub Desktop.
#!/bin/sh
# get internal IP, mac address, and public ip
# To install run the following
# sudo wget -qO /usr/local/bin/inet https://gist.githubusercontent.com/johan149/0598c69f193f34058cf77fa3c3b68551/raw/efcdcc0e0a8862e7de68f244af2cb0a20e33e06a/inet && sudo chmod a+x /usr/local/bin/inet
#to run just type and hit enter 'inet'
echo 'eno1'
eth1=eno1
ip addr show $eth1 | awk '/inet/ {print $2}' | cut -d/ -f1
echo ''
echo 'eno2'
eth2=eno2
ip addr show $eth2 | awk '/inet/ {print $2}' | cut -d/ -f1
echo ''
echo 'public ip'
(wget -qO- ifconfig.me | xargs echo)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment