Skip to content

Instantly share code, notes, and snippets.

@cbejensen
Created April 5, 2019 19:09
Show Gist options
  • Save cbejensen/61d752c93237c25dfac756c4bab7d086 to your computer and use it in GitHub Desktop.
Save cbejensen/61d752c93237c25dfac756c4bab7d086 to your computer and use it in GitHub Desktop.
Easily get and read your IP address
function ips
set eth (ipconfig getifaddr en0)
echo "Ethernet: $eth"
set wifi (ipconfig getifaddr en1)
echo "Wireless: $wifi"
end
@cbejensen
Copy link
Author

cbejensen commented Apr 5, 2019

This is for fish shell specifically, but can obviously be translated to other shells as well. Output of running ips:

Ethernet: 10.10.0.1
Wireless: 123.45.67.890

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment