Snipt.net is closing on December 31st, 2016

For more information, please visit this blog post.

snipt

Ctrl+h for KB shortcuts

Bash

Get External IP Address

#!/bin/bash
wget -q -O - checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//' 
https://snipt.net/embed/9f871bc6f2b9d0c3cd5a2567088aae5c/
https://snipt.net/raw/9f871bc6f2b9d0c3cd5a2567088aae5c/
9f871bc6f2b9d0c3cd5a2567088aae5c
bash
Bash
2
2016-12-02T06:50:17
True
False
False
Dec 09, 2013 at 04:42 PM
/api/public/snipt/99496/
get-external-ip-address
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="ch">#!/bin/bash</span> </span><span id="L-2"><a name="L-2"></a>wget -q -O - checkip.dyndns.org<span class="p">|</span>sed -e <span class="s1">&#39;s/.*Current IP Address: //&#39;</span> -e <span class="s1">&#39;s/&lt;.*$//&#39;</span> </span></pre></div> </td></tr></table>
address, ip

Bash

print the list of local IP addresses from ifconfig

#/bin/sh
ifconfig | grep 'inet addr' | awk '{print $2}' | cut -f 2 -d ':' 
https://snipt.net/embed/7876306ff771e8d768e07540988a7dc0/
https://snipt.net/raw/7876306ff771e8d768e07540988a7dc0/
7876306ff771e8d768e07540988a7dc0
bash
Bash
2
2016-12-02T12:19:15
True
False
False
/api/public/snipt/7133/
echo-address
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1">#/bin/sh</span> </span><span id="L-2"><a name="L-2"></a>ifconfig <span class="p">|</span> grep <span class="s1">&#39;inet addr&#39;</span> <span class="p">|</span> awk <span class="s1">&#39;{print $2}&#39;</span> <span class="p">|</span> cut -f <span class="m">2</span> -d <span class="s1">&#39;:&#39;</span> </span></pre></div> </td></tr></table>
address, awk, cut, grep, ifconfig, ip, shell
Copyrighted, illegal, or inappropriate content? Email [email protected].