snipt

Ctrl+h for KB shortcuts

Bash

Kill a Process by Name

$ pkill <process_name>
https://snipt.net/embed/77f3076d49053195ef1a19620c0ff111/
/raw/77f3076d49053195ef1a19620c0ff111/
77f3076d49053195ef1a19620c0ff111
bash
Bash
1
2019-06-16T00:36:17
True
False
False
Jul 22, 2012 at 12:50 PM
/api/public/snipt/44291/
kill-a-process-by-name
<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>$ pkill &lt;process_name&gt; </span></pre></div> </td></tr></table>
bash, linux

Bash Session

Push a local branch to a remote different branch

git push remote local_branch:remote_branch
https://snipt.net/embed/c227d744594e491495483cb192263a01/
/raw/c227d744594e491495483cb192263a01/
c227d744594e491495483cb192263a01
console
Bash Session
1
2019-07-17T15:38:32
True
False
False
/api/public/snipt/43162/
push-a-local-branch-to-a-remote-different-branch
<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="go">git push remote local_branch:remote_branch</span> </span></pre></div> </td></tr></table>
git

Bash

Resolve dependency problems

$ sudo apt-get -f install
https://snipt.net/embed/cd2033b6061a5706f347a8281aa25912/
/raw/cd2033b6061a5706f347a8281aa25912/
cd2033b6061a5706f347a8281aa25912
bash
Bash
1
2019-07-21T17:51:30
True
False
False
/api/public/snipt/42464/
resolve-dependency-problems
<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>$ sudo apt-get -f install </span></pre></div> </td></tr></table>
apt-get, ubuntu

Bash

Empty the content of a file

$ cat /dev/null > <file_name>
https://snipt.net/embed/cea489f186066b942837703409c069c9/
/raw/cea489f186066b942837703409c069c9/
cea489f186066b942837703409c069c9
bash
Bash
1
2019-07-03T18:39:46
True
False
False
/api/public/snipt/36665/
empty-the-content-of-a-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>$ cat /dev/null &gt; &lt;file_name&gt; </span></pre></div> </td></tr></table>
bash

Bash

Run a Ruby script which references custom libraries and gems

$ ruby -I<lib_dir> -rubygems <script_name>
https://snipt.net/embed/e3f0568e0c42796d3b903e5587510fdb/
/raw/e3f0568e0c42796d3b903e5587510fdb/
e3f0568e0c42796d3b903e5587510fdb
bash
Bash
1
2019-07-17T14:30:24
True
False
False
/api/public/snipt/36664/
run-a-ruby-script-which-references-custom-libraries-and-gems
<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>$ ruby -I&lt;lib_dir&gt; -rubygems &lt;script_name&gt; </span></pre></div> </td></tr></table>
ruby

Bash

Revert uncommitted changes

$ git reset --hard HEAD
https://snipt.net/embed/f29818839e2b75f8f8b4faf0d251ffde/
/raw/f29818839e2b75f8f8b4faf0d251ffde/
f29818839e2b75f8f8b4faf0d251ffde
bash
Bash
1
2019-07-02T14:38:38
True
False
False
/api/public/snipt/36547/
revert-uncommitted-changes
<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>$ git reset --hard HEAD </span></pre></div> </td></tr></table>
git

Bash

Search files by name

$ find . -iname <file_name>
https://snipt.net/embed/606510601c1d25459593d3cd8596c1dc/
/raw/606510601c1d25459593d3cd8596c1dc/
606510601c1d25459593d3cd8596c1dc
bash
Bash
1
2019-06-30T07:41:00
True
False
False
/api/public/snipt/35794/
search-files-by-name
<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>$ find . -iname &lt;file_name&gt; </span></pre></div> </td></tr></table>
bash, find

Bash

Open a new empty tab

:tabnew
https://snipt.net/embed/380135f9e728a680d640e1db5f29c68a/
/raw/380135f9e728a680d640e1db5f29c68a/
380135f9e728a680d640e1db5f29c68a
bash
Bash
1
2019-07-12T12:15:41
True
False
False
/api/public/snipt/35785/
open-a-new-empty-tab
<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>:tabnew </span></pre></div> </td></tr></table>
vim

Bash

Extract a tar.bz2 file

$ tar xfjv some-file.tar.bz2
https://snipt.net/embed/d9790828ee2f9ce116f169ac40a61bc2/
/raw/d9790828ee2f9ce116f169ac40a61bc2/
d9790828ee2f9ce116f169ac40a61bc2
bash
Bash
1
2019-07-17T09:56:40
True
False
False
/api/public/snipt/34515/
extract-a-tarbz2-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>$ tar xfjv some-file.tar.bz2 </span></pre></div> </td></tr></table>
tar

Bash

Create a branch based on the current HEAD

$ git checkout -b <branch_name>
https://snipt.net/embed/3cb8d753b8bfc8f648d678f732fdcf02/
/raw/3cb8d753b8bfc8f648d678f732fdcf02/
3cb8d753b8bfc8f648d678f732fdcf02
bash
Bash
1
2019-07-14T13:45:40
True
False
False
/api/public/snipt/33489/
create-a-branch-based-on-the-current-head
<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>$ git checkout -b &lt;branch_name&gt; </span></pre></div> </td></tr></table>
git