Snipt.net is closing on December 31st, 2016

For more information, please visit this blog post.

snipt

Ctrl+h for KB shortcuts

Bash

Fix broken packages in Ubuntu and Debian

1
2
3
4
5
6
7
8
dpkg --configure -a
apt-get install -f

# If the problem of a broken package still exist, the solution is to edit the dpkg status file manually.

nano /var/lib/dpkg/status

# Locate the corrupt package, and remove the whole block of information about it and save the file.
https://snipt.net/embed/c909f1463882443c12d770afa20dd0d1/
https://snipt.net/raw/c909f1463882443c12d770afa20dd0d1/
c909f1463882443c12d770afa20dd0d1
bash
Bash
8
2016-12-07T12:40:08
True
False
False
Dec 04, 2013 at 02:34 AM
/api/public/snipt/98414/
fix-broken-packages-in-ubuntu-and-debian
<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> <a href="#L-7">7</a> <a href="#L-8">8</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>dpkg --configure -a </span><span id="L-2"><a name="L-2"></a>apt-get install -f </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a><span class="c1"># If the problem of a broken package still exist, the solution is to edit the dpkg status file manually.</span> </span><span id="L-5"><a name="L-5"></a> </span><span id="L-6"><a name="L-6"></a>nano /var/lib/dpkg/status </span><span id="L-7"><a name="L-7"></a> </span><span id="L-8"><a name="L-8"></a><span class="c1"># Locate the corrupt package, and remove the whole block of information about it and save the file.</span> </span></pre></div> </td></tr></table>
apt, broken, debian, dpkg, fix, packages, status, ubuntu

Bash

Show recently installed or removed packages on Debian-based distros

awk '$3 ~ /install|remove/ {print $1 " "$3 ": "$4}' /var/log/dpkg.log
https://snipt.net/embed/10e467dce45be02443a441870d3f2add/
https://snipt.net/raw/10e467dce45be02443a441870d3f2add/
10e467dce45be02443a441870d3f2add
bash
Bash
1
2016-12-07T12:03:56
True
False
False
/api/public/snipt/36840/
show-recently-installed-or-removed-packages-on-debian-based-distros
<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>awk <span class="s1">&#39;$3 ~ /install|remove/ {print $1 &quot; &quot;$3 &quot;: &quot;$4}&#39;</span> /var/log/dpkg.log </span></pre></div> </td></tr></table>
awk, debian, dpkg, ubuntu

Bash

List out files of a package

$ dpkg -L <package_name>
https://snipt.net/embed/79d483aca302990a6bd2a84148a82f22/
https://snipt.net/raw/79d483aca302990a6bd2a84148a82f22/
79d483aca302990a6bd2a84148a82f22
bash
Bash
1
2016-12-02T13:38:01
True
False
False
/api/public/snipt/32439/
list-out-files-of-a-package
<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 -L &lt;package_name&gt; </span></pre></div> </td></tr></table>
dpkg, linux, ubuntu

Java

what package is this command from?

dpkg -S $(which clear)
https://snipt.net/embed/b5170ee1740071a3b20830483fbf9dc1/
https://snipt.net/raw/b5170ee1740071a3b20830483fbf9dc1/
b5170ee1740071a3b20830483fbf9dc1
java
Java
1
2016-12-09T00:27:32
True
False
False
/api/public/snipt/28734/
what-package-is-this-command-from
<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="n">dpkg</span> <span class="o">-</span><span class="n">S</span> <span class="nf">$</span><span class="o">(</span><span class="n">which</span> <span class="n">clear</span><span class="o">)</span> </span></pre></div> </td></tr></table>
bash, dpkg, linux

Bash

Install deb packages

$ dpkg -i package.deb
https://snipt.net/embed/06dbfef3933a0daed8ef2459da95f4b5/
https://snipt.net/raw/06dbfef3933a0daed8ef2459da95f4b5/
06dbfef3933a0daed8ef2459da95f4b5
bash
Bash
1
2016-12-09T16:14:12
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

JavaScript

freddy

aptfix='sudo dpkg --configure -a'
https://snipt.net/embed/eda56def9e82a3936a75aff3f4e66330/
https://snipt.net/raw/eda56def9e82a3936a75aff3f4e66330/
eda56def9e82a3936a75aff3f4e66330
js
JavaScript
2
2016-12-02T13:38:07
True
False
False
/api/public/snipt/6516/
freddy
<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="nx">aptfix</span><span class="o">=</span><span class="s1">&#39;sudo dpkg --configure -a&#39;</span> </span></pre></div> </td></tr></table>
--configure, -a', aptfix='sudo, dpkg

Bash

Retirer un package des mises à jour apt-get sous Debian

apt-get install wajig
wajig hold <package_name>
https://snipt.net/embed/ee48f3dcee921701c3b6eb703f9fb31e/
https://snipt.net/raw/ee48f3dcee921701c3b6eb703f9fb31e/
ee48f3dcee921701c3b6eb703f9fb31e
bash
Bash
2
2016-12-09T12:27:48
True
False
False
/api/public/snipt/5688/
retirer-un-package-des-mises-a-jour-apt-get-sous-debian
<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>apt-get install wajig </span><span id="L-2"><a name="L-2"></a>wajig hold &lt;package_name&gt; </span></pre></div> </td></tr></table>
apt-get, debian, dpkg, linux, update, upgrade

Bash

save/restore debian package selections

1
2
3
$ sudo dpkg --get-selections >packages.txt
$ sudo dpkg --set-selections <packages.txt
$ sudo apt-get dselect-upgrade
https://snipt.net/embed/8eff9d1fde7c40dd7062916beca63dd0/
https://snipt.net/raw/8eff9d1fde7c40dd7062916beca63dd0/
8eff9d1fde7c40dd7062916beca63dd0
bash
Bash
3
2016-12-02T13:38:12
True
False
False
/api/public/snipt/5529/
saverestore-debian-package-selections
<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>$ sudo dpkg --get-selections &gt;packages.txt </span><span id="L-2"><a name="L-2"></a>$ sudo dpkg --set-selections &lt;packages.txt </span><span id="L-3"><a name="L-3"></a>$ sudo apt-get dselect-upgrade </span></pre></div> </td></tr></table>
apt, debian, dpkg, ubuntu

Bash

list repositories for a deb package

1
2
3
4
5
6
7
8
$ sudo apt-get install apt-show-versions
$ apt-show-versions -a git-core
git-core 1:1.6.0.4-1ubuntu2 install ok installed
git-core 1:1.5.6.3-1.1ubuntu2   intrepid          fi.archive.ubuntu.com
git-core 1:1.5.6.3-1.1ubuntu2.1 intrepid-security security.ubuntu.com
git-core 1:1.6.0.4-1ubuntu2     jaunty            fi.archive.ubuntu.com
No unstable version
git-core/jaunty uptodate 1:1.6.0.4-1ubuntu2
https://snipt.net/embed/d8d74718b12f9a51c299d2a619db73c8/
https://snipt.net/raw/d8d74718b12f9a51c299d2a619db73c8/
d8d74718b12f9a51c299d2a619db73c8
bash
Bash
8
2016-12-07T21:52:56
True
False
False
/api/public/snipt/5465/
list-repositories-for-a-deb-package
<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> <a href="#L-7">7</a> <a href="#L-8">8</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 install apt-show-versions </span><span id="L-2"><a name="L-2"></a>$ apt-show-versions -a git-core </span><span id="L-3"><a name="L-3"></a>git-core 1:1.6.0.4-1ubuntu2 install ok installed </span><span id="L-4"><a name="L-4"></a>git-core 1:1.5.6.3-1.1ubuntu2 intrepid <span class="k">fi</span>.archive.ubuntu.com </span><span id="L-5"><a name="L-5"></a>git-core 1:1.5.6.3-1.1ubuntu2.1 intrepid-security security.ubuntu.com </span><span id="L-6"><a name="L-6"></a>git-core 1:1.6.0.4-1ubuntu2 jaunty <span class="k">fi</span>.archive.ubuntu.com </span><span id="L-7"><a name="L-7"></a>No unstable version </span><span id="L-8"><a name="L-8"></a>git-core/jaunty uptodate 1:1.6.0.4-1ubuntu2 </span></pre></div> </td></tr></table>
apt, debian, dpkg, query, repository, ubuntu

Bash

Show installed Debian packages sorted by size

dpkg-query -W -f='${Installed-Size} ${Package}\n' | sort -n
https://snipt.net/embed/9fcc084bb02f57627c9e76fa8ff3c636/
https://snipt.net/raw/9fcc084bb02f57627c9e76fa8ff3c636/
9fcc084bb02f57627c9e76fa8ff3c636
bash
Bash
1
2016-12-07T12:04:06
True
False
False
/api/public/snipt/4920/
show-installed-debian-packages-sorted-by-size
<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-query -W -f<span class="o">=</span><span class="s1">&#39;${Installed-Size} ${Package}\n&#39;</span> <span class="p">|</span> sort -n </span></pre></div> </td></tr></table>
bash, deb, debian, dpkg, sort
Copyrighted, illegal, or inappropriate content? Email [email protected].