snipt

Ctrl+h for KB shortcuts

Bash

Ignore changes to tracked files

1
2
3
4
$ git update-index --assume-unchanged path/to/database.yml

# Find files marked as --assume-unchanged
$ git ls-files -v | grep -e "^[hsmrck]"
https://snipt.net/embed/35528a29f99407565d832103f9f25eb2/
/raw/35528a29f99407565d832103f9f25eb2/
35528a29f99407565d832103f9f25eb2
bash
Bash
4
2019-07-17T17:46:33
True
False
False
/api/public/snipt/18214/
ignore-changes-to-tracked-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 path/to/database.yml </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a><span class="c1"># Find files marked as --assume-unchanged</span> </span><span id="L-4"><a name="L-4"></a>$ git ls-files -v <span class="p">|</span> grep -e <span class="s2">&quot;^[hsmrck]&quot;</span> </span></pre></div> </td></tr></table>
git

Bash

Set user name and email in git

1
2
3
$ cd my_repo
$ git config user.name "My Name"
$ git config user.email "[email protected]"
https://snipt.net/embed/592baa5bd8747135b386217b49c24eb7/
/raw/592baa5bd8747135b386217b49c24eb7/
592baa5bd8747135b386217b49c24eb7
bash
Bash
3
2019-07-18T07:32:26
True
False
False
/api/public/snipt/18213/
set-user-name-and-email-in-git
<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>$ <span class="nb">cd</span> my_repo </span><span id="L-2"><a name="L-2"></a>$ git config user.name <span class="s2">&quot;My Name&quot;</span> </span><span id="L-3"><a name="L-3"></a>$ git config user.email <span class="s2">&quot;[email protected]&quot;</span> </span></pre></div> </td></tr></table>
git

Bash

Install deb packages

$ dpkg -i package.deb
https://snipt.net/embed/06dbfef3933a0daed8ef2459da95f4b5/
/raw/06dbfef3933a0daed8ef2459da95f4b5/
06dbfef3933a0daed8ef2459da95f4b5
bash
Bash
1
2019-07-14T07:15:41
True
False
False
/api/public/snipt/17243/
install-deb-packages
<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>$ dpkg -i package.deb </span></pre></div> </td></tr></table>
dpkg, ubuntu

Bash

View the change history of a file

$ git log -- <filename>
https://snipt.net/embed/31f7e2d841a86203eebda33b46d510d3/
/raw/31f7e2d841a86203eebda33b46d510d3/
31f7e2d841a86203eebda33b46d510d3
bash
Bash
1
2019-07-22T00:03:25
True
False
False
/api/public/snipt/16822/
view-the-change-history-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>$ git log -- &lt;filename&gt; </span></pre></div> </td></tr></table>
git

Bash

Restore deleted files from a git repo

$ git log --diff-filter=D --summary
$ git revert $commit
https://snipt.net/embed/722c08cd56925de7d35655e0ff69673c/
/raw/722c08cd56925de7d35655e0ff69673c/
722c08cd56925de7d35655e0ff69673c
bash
Bash
2
2019-07-17T11:27:19
True
False
False
/api/public/snipt/16207/
restore-deleted-files-from-a-git-repo
<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 log --diff-filter<span class="o">=</span>D --summary </span><span id="L-2"><a name="L-2"></a>$ git revert <span class="nv">$commit</span> </span></pre></div> </td></tr></table>
git

Bash

Extract a tar.gz file

$ tar xfzv some-file.tar.gz
https://snipt.net/embed/61c245aacff81c0e8cf8d4d383a91cf4/
/raw/61c245aacff81c0e8cf8d4d383a91cf4/
61c245aacff81c0e8cf8d4d383a91cf4
bash
Bash
1
2019-07-17T18:35:54
True
False
False
/api/public/snipt/14691/
extract-a-targz-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 xfzv some-file.tar.gz </span></pre></div> </td></tr></table>
tar

Bash

Check Cygwin version

$ uname -srv
https://snipt.net/embed/0444686ca00c995ade64d3ac4774033c/
/raw/0444686ca00c995ade64d3ac4774033c/
0444686ca00c995ade64d3ac4774033c
bash
Bash
1
2019-07-20T23:18:45
True
False
False
/api/public/snipt/13812/
check-cygwin-version
<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>$ uname -srv </span></pre></div> </td></tr></table>
cygwin

Bash

List processes and ports

$ netstat -lp
https://snipt.net/embed/2ca5dde366a5b99f41abe70189117c2f/
/raw/2ca5dde366a5b99f41abe70189117c2f/
2ca5dde366a5b99f41abe70189117c2f
bash
Bash
1
2019-07-04T06:20:00
True
False
False
/api/public/snipt/12549/
list-processes-and-ports
<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>$ netstat -lp </span></pre></div> </td></tr></table>
bash

Bash

View sendmail queue

$ mailq OR $ sendmail -bp
https://snipt.net/embed/dac3dda8f57af2ad81b78b348b6e56d0/
/raw/dac3dda8f57af2ad81b78b348b6e56d0/
dac3dda8f57af2ad81b78b348b6e56d0
bash
Bash
1
2019-07-07T10:47:20
True
False
False
/api/public/snipt/12245/
view-sendmail-queue
<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>$ mailq OR $ sendmail -bp </span></pre></div> </td></tr></table>
sendmail

Bash

Restore MySQL databases from dump files

$ mysql -u [username] -p [database_name] < [dump_file_path]
https://snipt.net/embed/bae507dfeb25976f57fdf2768a0d0559/
/raw/bae507dfeb25976f57fdf2768a0d0559/
bae507dfeb25976f57fdf2768a0d0559
bash
Bash
1
2019-07-11T15:59:21
True
False
False
/api/public/snipt/11761/
restore-mysql-databases-from-dump-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>$ mysql -u <span class="o">[</span>username<span class="o">]</span> -p <span class="o">[</span>database_name<span class="o">]</span> &lt; <span class="o">[</span>dump_file_path<span class="o">]</span> </span></pre></div> </td></tr></table>
mysql