Guest User

Untitled

a guest
Feb 25th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. sudo ifconfig | head -n 2 | tail -n 1 | tr -s " " | tr " " ":" | cut -d":" -f 4
  2.  
  3. /sbin/ifconfig $(/sbin/route -n |
  4. awk '$1 == "0.0.0.0" {print $8}') |
  5. awk 'match($0, /inet addr:[.0-9]+/) {print substr($0, RSTART+10, RLENGTH-10)}'
  6.  
  7. /sbin/ip addr show eth0 | awk -F"[ /]+" '/inet / {print $3}'
  8.  
  9. ipadm show-addr net0/v4 | awk -F"[ /]+" '/ok/ {print $5}'
  10.  
  11. ipconfig getifaddr en0
  12.  
  13. ifconfig eth0 | awk -F"[ :]+" '/inet / {print $4}'
  14.  
  15. getent hosts "$(hostname)" | awk '{ print $1 }'
  16.  
  17. ip route get 1.2.3.4
  18.  
  19. 74.125.139.102 via 192.168.0.1 dev wlan0 src 192.168.0.24
  20. cache
  21.  
  22. ip route get 1.2.3.4 | grep -oP '(?<=src )S+'
  23.  
  24. ip route get "$(ip route show to 0/0 | grep -oP '(?<=via )S+')"
  25.  
  26. ip route get "$(ip route show to 0/0 | grep -oP '(?<=via )S+')" | grep -oP '(?<=src )S+'
Add Comment
Please, Sign In to add comment