snipt

Ctrl+h for KB shortcuts

Text only

Find ip address in terminal OSX Mac

ipconfig getifaddr en1
https://snipt.net/embed/b91f0d01eb2baf011d6eee71ab85fb92/
https://snipt.net/raw/b91f0d01eb2baf011d6eee71ab85fb92/
b91f0d01eb2baf011d6eee71ab85fb92
text
Text only
1
2016-09-27T04:37:10
True
False
False
/api/public/snipt/39365/
find-ip-address-in-terminal-osx-mac
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a>ipconfig getifaddr en1 </span></pre></div> </td></tr></table>
"ip address", mac, osx, terminal

Text only

Display Visitors IP Address via CGI

1
2
3
4
#!/bin/sh
echo "Content-type: text/plain"
echo
echo $REMOTE_ADDR
https://snipt.net/embed/40ed6f16019355838399f827bef047d6/
https://snipt.net/raw/40ed6f16019355838399f827bef047d6/
40ed6f16019355838399f827bef047d6
text
Text only
4
2016-09-28T03:19:34
True
False
False
/api/public/snipt/3974/
display-visitors-ip-address-via-cgi
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a>#!/bin/sh </span><span id="L-2"><a name="L-2"></a>echo &quot;Content-type: text/plain&quot; </span><span id="L-3"><a name="L-3"></a>echo </span><span id="L-4"><a name="L-4"></a>echo $REMOTE_ADDR </span></pre></div> </td></tr></table>
"ip address", cgi

PHP

Display Visitors IP Address

1
2
3
4
<?php
  header("Content-type: text/plain");
  echo $_SERVER['REMOTE_ADDR'];
?>
https://snipt.net/embed/e30f738e777cfbf9cdba4d43b060db89/
https://snipt.net/raw/e30f738e777cfbf9cdba4d43b060db89/
e30f738e777cfbf9cdba4d43b060db89
php
PHP
4
2016-09-27T08:44:01
True
False
False
/api/public/snipt/3973/
display-visitors-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> <a href="#L-3">3</a> <a href="#L-4">4</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="cp">&lt;?php</span> </span><span id="L-2"><a name="L-2"></a> <span class="nb">header</span><span class="p">(</span><span class="s2">&quot;Content-type: text/plain&quot;</span><span class="p">);</span> </span><span id="L-3"><a name="L-3"></a> <span class="k">echo</span> <span class="nv">$_SERVER</span><span class="p">[</span><span class="s1">&#39;REMOTE_ADDR&#39;</span><span class="p">];</span> </span><span id="L-4"><a name="L-4"></a><span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
"ip address", php

Bash

External IP address

echo "External :" `curl --silent http://checkip.dyndns.org | awk '{print $6}' | cut -f 1 -d "<"`
https://snipt.net/embed/e5902772d0a7b90d980f77dfad56c486/
https://snipt.net/raw/e5902772d0a7b90d980f77dfad56c486/
e5902772d0a7b90d980f77dfad56c486
bash
Bash
1
2016-09-26T22:11:48
True
False
False
/api/public/snipt/3002/
external-ip-address
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="nb">echo</span> <span class="s2">&quot;External :&quot;</span> <span class="sb">`</span>curl --silent http://checkip.dyndns.org <span class="p">|</span> awk <span class="s1">&#39;{print $6}&#39;</span> <span class="p">|</span> cut -f <span class="m">1</span> -d <span class="s2">&quot;&lt;&quot;</span><span class="sb">`</span> </span></pre></div> </td></tr></table>
"ip address", bash, monitoring, network, scripts
Copyrighted, illegal, or inappropriate content? Email support@snipt.net.