Snipt.net is closing on December 31st, 2016

For more information, please visit this blog post.

snipt

Ctrl+h for KB shortcuts

Bash

View the last <n> commands

history <n>
https://snipt.net/embed/3c2d069747d547f7ec731c09fd358cad/
https://snipt.net/raw/3c2d069747d547f7ec731c09fd358cad/
3c2d069747d547f7ec731c09fd358cad
bash
Bash
1
2016-12-02T14:16:35
True
False
False
/api/public/snipt/50508/
view-the-last-n-commands
<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><span class="nb">history</span> &lt;n&gt; </span></pre></div> </td></tr></table>
bash, history

Bash

Execute a specific command from history

!<history_id>
https://snipt.net/embed/30ea22287d3ab67d114dafb00da5ae42/
https://snipt.net/raw/30ea22287d3ab67d114dafb00da5ae42/
30ea22287d3ab67d114dafb00da5ae42
bash
Bash
1
2016-12-02T14:16:37
True
False
False
/api/public/snipt/50452/
execute-a-specific-command-from-history
<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>!&lt;history_id&gt; </span></pre></div> </td></tr></table>
bash, history

HTML

history.back Compatible

<a href="javascript:void(0);" onclick="history.back(); return false;">Back</a>
https://snipt.net/embed/0865f17d284bf173525f4560fda1f7d5/
https://snipt.net/raw/0865f17d284bf173525f4560fda1f7d5/
0865f17d284bf173525f4560fda1f7d5
html
HTML
1
2016-12-02T14:16:39
True
False
False
/api/public/snipt/31992/
historyback-compatible
<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><span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;javascript:void(0);&quot;</span> <span class="na">onclick</span><span class="o">=</span><span class="s">&quot;history.back(); return false;&quot;</span><span class="p">&gt;</span>Back<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span> </span></pre></div> </td></tr></table>
back, history

JavaScript

javascript back

<a href="javascript:history.back()">Back</a>
https://snipt.net/embed/5e2cf57f7753cd82acd25dddc0760812/
https://snipt.net/raw/5e2cf57f7753cd82acd25dddc0760812/
5e2cf57f7753cd82acd25dddc0760812
js
JavaScript
1
2016-12-02T14:16:42
True
False
False
/api/public/snipt/16168/
javascript-back
<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><span class="o">&lt;</span><span class="nx">a</span> <span class="nx">href</span><span class="o">=</span><span class="s2">&quot;javascript:history.back()&quot;</span><span class="o">&gt;</span><span class="nx">Back</span><span class="o">&lt;</span><span class="err">/a&gt;</span> </span></pre></div> </td></tr></table>
back, history, js

Bash

Add date and time to every command listed in Bash history

1
2
3
:> ~/.bash_history
history -c
export HISTTIMEFORMAT='%F %T    '
https://snipt.net/embed/8a3e0eeb694e8cb7865c0236f97e9d0c/
https://snipt.net/raw/8a3e0eeb694e8cb7865c0236f97e9d0c/
8a3e0eeb694e8cb7865c0236f97e9d0c
bash
Bash
3
2016-12-04T09:46:57
True
False
False
/api/public/snipt/14495/
add-date-and-time-to-every-command-listed-in-bash-history
<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>:&gt; ~/.bash_history </span><span id="L-2"><a name="L-2"></a><span class="nb">history</span> -c </span><span id="L-3"><a name="L-3"></a><span class="nb">export</span> <span class="nv">HISTTIMEFORMAT</span><span class="o">=</span><span class="s1">&#39;%F %T &#39;</span> </span></pre></div> </td></tr></table>
bash, date, history, time

Bash

Bash—please save my history for ever and eternity (or, at least a really long time)

1
2
3
4
5
6
# In .bashrc or .bash_profile
export HISTCONTROL=ignoredups:ignorespace
export HISTSIZE=10000
export HISTFILESIZE=1000000
export HISTTIMEFORMAT="%F %T "
export PROMPT_COMMAND='history -a'
https://snipt.net/embed/66a35c6d935778d767cbf849bd50c74f/
https://snipt.net/raw/66a35c6d935778d767cbf849bd50c74f/
66a35c6d935778d767cbf849bd50c74f
bash
Bash
7
2016-12-05T05:51:36
True
False
False
/api/public/snipt/6723/
bashsave-my-history-for-ever-and-eternity-well-almost
<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> <a href="#L-5">5</a> <a href="#L-6">6</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"># In .bashrc or .bash_profile</span> </span><span id="L-2"><a name="L-2"></a><span class="nb">export</span> <span class="nv">HISTCONTROL</span><span class="o">=</span>ignoredups:ignorespace </span><span id="L-3"><a name="L-3"></a><span class="nb">export</span> <span class="nv">HISTSIZE</span><span class="o">=</span>10000 </span><span id="L-4"><a name="L-4"></a><span class="nb">export</span> <span class="nv">HISTFILESIZE</span><span class="o">=</span>1000000 </span><span id="L-5"><a name="L-5"></a><span class="nb">export</span> <span class="nv">HISTTIMEFORMAT</span><span class="o">=</span><span class="s2">&quot;%F %T &quot;</span> </span><span id="L-6"><a name="L-6"></a><span class="nb">export</span> <span class="nv">PROMPT_COMMAND</span><span class="o">=</span><span class="s1">&#39;history -a&#39;</span> </span></pre></div> </td></tr></table>
bash, history

Bash

Clear out history

1
2
3
4
5
6
history -c 

#w ill clear the entire bash history.

# To only clear the current session history use:
history -r.
https://snipt.net/embed/5412e7c9176602ab87609b8a599205e5/
https://snipt.net/raw/5412e7c9176602ab87609b8a599205e5/
5412e7c9176602ab87609b8a599205e5
bash
Bash
6
2016-12-02T14:16:56
True
False
False
/api/public/snipt/5173/
clear-out-history
<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> <a href="#L-5">5</a> <a href="#L-6">6</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="nb">history</span> -c </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a><span class="c1">#w ill clear the entire bash history.</span> </span><span id="L-4"><a name="L-4"></a> </span><span id="L-5"><a name="L-5"></a><span class="c1"># To only clear the current session history use:</span> </span><span id="L-6"><a name="L-6"></a><span class="nb">history</span> -r. </span></pre></div> </td></tr></table>
clear, delete, history
Copyrighted, illegal, or inappropriate content? Email [email protected].