From b1dfcba21e0e480b6c0a0f3be38bc81e5635020d Mon Sep 17 00:00:00 2001 From: jamieparfet <9058983+jamieparfet@users.noreply.github.com> Date: Fri, 30 Aug 2019 10:12:11 +0200 Subject: [PATCH] Update bash.md --- misc/bash.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/bash.md b/misc/bash.md index 725211c..c854a28 100644 --- a/misc/bash.md +++ b/misc/bash.md @@ -14,7 +14,7 @@ Sort IPs in file (1 per line) | `sort -t . -k 3,3n -k 4,4n file.txt` Function | Command ------------ | ------------- Get IP address (Linux) | `hostname -I` -Get IP address of eth0 (Ubuntu) | `ifconfig eth0 \| grep 'inet addr' \| cut -d: -f2 \| awk '{print $1}'`
`ip -4 addr show eth0 \| grep -oP '(?<=inet\s)\d+(\.\d+){3}'` +Get IP address of eth0 (Ubuntu) | `ifconfig eth0 | grep 'inet addr' \| cut -d: -f2 \| awk '{print $1}'`
`ip -4 addr show eth0 \| grep -oP '(?<=inet\s)\d+(\.\d+){3}'` Get IP address of eth0 (Debian/OS X) | `ifconfig eth0 \| grep 'inet ' \| awk '{print $2}'` Get IP address of en0 (OS X) | `ipconfig getifaddr en0` Get external IP | `curl icanhazip.com`
`curl checkip.amazonaws.com`
`curl eth0.me`
`dig +short myip.opendns.com @resolver1.opendns.com`