snipt

Ctrl+h for KB shortcuts

Bash

Ignore versioned files

1
2
3
4
git update-index --assume-unchanged <files>

# To get back to tracking the file changes
git update-index --no-assume-unchanged <files>
https://snipt.net/embed/22fc3da935328de88495b701221b5e54/
/raw/22fc3da935328de88495b701221b5e54/
22fc3da935328de88495b701221b5e54
bash
Bash
4
2019-06-29T23:45:00
True
False
False
Apr 01, 2013 at 02:59 AM
/api/public/snipt/58622/
ignore-versioned-files
<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></span><span id="L-1"><a name="L-1"></a>git update-index --assume-unchanged &lt;files&gt; </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a><span class="c1"># To get back to tracking the file changes</span> </span><span id="L-4"><a name="L-4"></a>git update-index --no-assume-unchanged &lt;files&gt; </span></pre></div> </td></tr></table>
git

Bash

Restore a deleted file

1
2
3
4
5
6
git rev-list -n 1 HEAD -- <file_path>
git checkout <deleting_commit>^ -- <file_path>

OR

git checkout $(git rev-list -n 1 HEAD -- "$file")^ -- "$file"
https://snipt.net/embed/cdf86d3351fb49f73848f7051e2fa0d5/
/raw/cdf86d3351fb49f73848f7051e2fa0d5/
cdf86d3351fb49f73848f7051e2fa0d5
bash
Bash
6
2019-07-03T03:29:36
True
False
False
Jan 16, 2013 at 07:00 AM
/api/public/snipt/53829/
restore-a-deleted-file
<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>git rev-list -n <span class="m">1</span> HEAD -- &lt;file_path&gt; </span><span id="L-2"><a name="L-2"></a>git checkout &lt;deleting_commit&gt;^ -- &lt;file_path&gt; </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a>OR </span><span id="L-5"><a name="L-5"></a> </span><span id="L-6"><a name="L-6"></a>git checkout <span class="k">$(</span>git rev-list -n <span class="m">1</span> HEAD -- <span class="s2">&quot;</span><span class="nv">$file</span><span class="s2">&quot;</span><span class="k">)</span>^ -- <span class="s2">&quot;</span><span class="nv">$file</span><span class="s2">&quot;</span> </span></pre></div> </td></tr></table>
git

Bash

View the last <n> commands

history <n>
https://snipt.net/embed/3c2d069747d547f7ec731c09fd358cad/
/raw/3c2d069747d547f7ec731c09fd358cad/
3c2d069747d547f7ec731c09fd358cad
bash
Bash
1
2019-07-05T18:16:00
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/
/raw/30ea22287d3ab67d114dafb00da5ae42/
30ea22287d3ab67d114dafb00da5ae42
bash
Bash
1
2019-07-15T17:19:32
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

Bash

List properties recursively

svn proplist -v -R <directory>
https://snipt.net/embed/bb3bded62d7c60d4520fef426aa0353c/
/raw/bb3bded62d7c60d4520fef426aa0353c/
bb3bded62d7c60d4520fef426aa0353c
bash
Bash
1
2019-07-15T10:55:52
True
False
False
Oct 26, 2012 at 09:05 PM
/api/public/snipt/49130/
list-properties-recursively
<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>svn proplist -v -R &lt;directory&gt; </span></pre></div> </td></tr></table>
subversion

Bash

Extract multiple files with 7z

7z x '*.zip'
https://snipt.net/embed/e90a879e78dd35d3371d48403c496fd5/
/raw/e90a879e78dd35d3371d48403c496fd5/
e90a879e78dd35d3371d48403c496fd5
bash
Bash
1
2019-07-15T12:57:52
True
False
False
Oct 05, 2012 at 10:16 PM
/api/public/snipt/48159/
extract-multiple-files-with-7z
<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>7z x <span class="s1">&#39;*.zip&#39;</span> </span></pre></div> </td></tr></table>
7z

Bash

Create a tag

git tag -a <tag_name>
git push --tags			
https://snipt.net/embed/f7b73c596330a89302fa9e9d3806c36c/
/raw/f7b73c596330a89302fa9e9d3806c36c/
f7b73c596330a89302fa9e9d3806c36c
bash
Bash
2
2019-07-10T03:53:48
True
False
False
/api/public/snipt/47769/
create-a-tag
<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>git tag -a &lt;tag_name&gt; </span><span id="L-2"><a name="L-2"></a>git push --tags </span></pre></div> </td></tr></table>
git

Bash

Change the owner of a symbolic link

$ chown -h <user>:<group> <symbolic_link>
https://snipt.net/embed/ffabb099faa6e102a803e2a42673c254/
/raw/ffabb099faa6e102a803e2a42673c254/
ffabb099faa6e102a803e2a42673c254
bash
Bash
1
2019-07-06T07:05:51
True
False
False
Sep 13, 2012 at 04:15 AM
/api/public/snipt/47120/
change-the-owner-of-a-symbolic-link
<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>$ chown -h &lt;user&gt;:&lt;group&gt; &lt;symbolic_link&gt; </span></pre></div> </td></tr></table>
bash

Text only

Merge PDF files

gs -q -sPAPERSIZE=letter -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=output.pdf file1.pdf file2.pdf file3.pdf [...] lastfile.pdf
https://snipt.net/embed/34de95a99d306bcc8c980cf3c2b1a62e/
/raw/34de95a99d306bcc8c980cf3c2b1a62e/
34de95a99d306bcc8c980cf3c2b1a62e
text
Text only
1
2019-07-12T15:43:12
True
False
False
/api/public/snipt/46151/
merge-pdf-files-1
<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>gs -q -sPAPERSIZE=letter -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=output.pdf file1.pdf file2.pdf file3.pdf [...] lastfile.pdf </span></pre></div> </td></tr></table>
pdf

Bash

Remove missing files

$ svn rm $( svn status | sed -e '/^!/!d' -e 's/^!//' )
https://snipt.net/embed/757e83864a6bcfef4d3ea437578a2e60/
/raw/757e83864a6bcfef4d3ea437578a2e60/
757e83864a6bcfef4d3ea437578a2e60
bash
Bash
1
2019-07-14T17:05:22
True
False
False
/api/public/snipt/44856/
remove-missing-files
<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>$ svn rm <span class="k">$(</span> svn status <span class="p">|</span> sed -e <span class="s1">&#39;/^!/!d&#39;</span> -e <span class="s1">&#39;s/^!//&#39;</span> <span class="k">)</span> </span></pre></div> </td></tr></table>
subversion