snipt

Ctrl+h for KB shortcuts

Bash

Get package version from deb file

debFile="/path/to/deb/file"
dpkg -I "$debFile"  | grep -oP '(?<=Version: ).*'
https://snipt.net/embed/0bf8d894f6ead618ac4cf860825e6a34/
/raw/0bf8d894f6ead618ac4cf860825e6a34/
0bf8d894f6ead618ac4cf860825e6a34
bash
Bash
2
2019-06-18T04:03:52
True
False
False
Oct 06, 2015 at 08:16 AM
/api/public/snipt/141521/
get-package-version-from-deb-file
<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><span class="nv">debFile</span><span class="o">=</span><span class="s2">&quot;/path/to/deb/file&quot;</span> </span><span id="L-2"><a name="L-2"></a>dpkg -I <span class="s2">&quot;</span><span class="nv">$debFile</span><span class="s2">&quot;</span> <span class="p">|</span> grep -oP <span class="s1">&#39;(?&lt;=Version: ).*&#39;</span> </span></pre></div> </td></tr></table>
bash, deb, linux, package, ubuntu

Bash

Sort Debian installed packages by size

dpkg-query --show --showformat='${Package;-50}\t${Installed-Size}\n' | sort -k2 -n
https://snipt.net/embed/bc027c19078f75b6b44c8fef438738b9/
/raw/bc027c19078f75b6b44c8fef438738b9/
bc027c19078f75b6b44c8fef438738b9
bash
Bash
1
2019-06-14T05:52:36
True
False
False
/api/public/snipt/6388/
sorting-debian-installed-packages-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 --show --showformat<span class="o">=</span><span class="s1">&#39;${Package;-50}\t${Installed-Size}\n&#39;</span> <span class="p">|</span> sort -k2 -n </span></pre></div> </td></tr></table>
bash, deb, debian, sort

Bash

Show installed Debian packages sorted by size

dpkg-query -W -f='${Installed-Size} ${Package}\n' | sort -n
https://snipt.net/embed/9fcc084bb02f57627c9e76fa8ff3c636/
/raw/9fcc084bb02f57627c9e76fa8ff3c636/
9fcc084bb02f57627c9e76fa8ff3c636
bash
Bash
1
2019-06-08T02:35:32
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

Bash

sort installed debian packages by size

dpkg-query -W -f='${Installed-Size} ${Package}\n' | sort -n
https://snipt.net/embed/328c1af5ed831137641d4d19e9f5853c/
/raw/328c1af5ed831137641d4d19e9f5853c/
328c1af5ed831137641d4d19e9f5853c
bash
Bash
1
2019-06-15T18:50:27
True
False
False
/api/public/snipt/4246/
sort-installed-debian-packages-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, dpkg