snipt

Ctrl+h for KB shortcuts

Bash

print the 100th line from the file

sed -n 100p somefile.txt
https://snipt.net/embed/b605c0b9565e0a3571da14682b218fd7/
/raw/b605c0b9565e0a3571da14682b218fd7/
b605c0b9565e0a3571da14682b218fd7
bash
Bash
1
2019-05-13T13:26:06
True
False
False
/api/public/snipt/1592/
print-the-100th-line-from-the-file
<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></span><span id="L-1"><a name="L-1"></a>sed -n 100p somefile.txt </span></pre></div> </td></tr></table>
bash, sed, text

Bash

accessing args from previous command

1
2
3
ls -alrt /tmp /var/ /usr
cd !:2
-> cd /tmp
https://snipt.net/embed/41b4e5329cc9c53b50317fdae5da61e4/
/raw/41b4e5329cc9c53b50317fdae5da61e4/
41b4e5329cc9c53b50317fdae5da61e4
bash
Bash
3
2019-05-11T20:03:59
True
False
False
/api/public/snipt/967/
accessing-args-from-previous-command
<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></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>ls -alrt /tmp /var/ /usr </span><span id="L-2"><a name="L-2"></a><span class="nb">cd</span> !:2 </span><span id="L-3"><a name="L-3"></a>-&gt; <span class="nb">cd</span> /tmp </span></pre></div> </td></tr></table>
bash, shell

Bash

shell substitution

1
2
3
cl config.ini config.ini.bak
^cl^cp
!!:gs/cl/cp/
https://snipt.net/embed/d9b0ea9425b7633b25d6e597bd46baa4/
/raw/d9b0ea9425b7633b25d6e597bd46baa4/
d9b0ea9425b7633b25d6e597bd46baa4
bash
Bash
3
2019-05-11T16:31:51
True
False
False
/api/public/snipt/966/
shell-substitution
<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></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>cl config.ini config.ini.bak </span><span id="L-2"><a name="L-2"></a>^cl^cp </span><span id="L-3"><a name="L-3"></a>!!:gs/cl/cp/ </span></pre></div> </td></tr></table>
bash, shell