Snipt.net is closing on December 31st, 2016

For more information, please visit this blog post.

snipt

Ctrl+h for KB shortcuts

Bash

Install from an RPM file

$ rpm -iv <rpm_file>
https://snipt.net/embed/a71a014acd1e993157c58213d0af02ba/
https://snipt.net/raw/a71a014acd1e993157c58213d0af02ba/
a71a014acd1e993157c58213d0af02ba
bash
Bash
1
2016-12-02T13:44:12
True
False
False
/api/public/snipt/26663/
install-from-an-rpm-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>$ rpm -iv &lt;rpm_file&gt; </span></pre></div> </td></tr></table>
bash, linux, rpm

Bash

Show the installation folders of a package

$ rpm -qil <package_name>
https://snipt.net/embed/dab82799873756190660487f74e3957f/
https://snipt.net/raw/dab82799873756190660487f74e3957f/
dab82799873756190660487f74e3957f
bash
Bash
1
2016-12-02T13:44:18
True
False
False
/api/public/snipt/24533/
show-the-installation-folders-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>$ rpm -qil &lt;package_name&gt; </span></pre></div> </td></tr></table>
rpm

Bash

repository, rpm

1
2
3
#repository listing

rpm -qa
https://snipt.net/embed/c32185d26673e136eb3dc2371c9b6236/
https://snipt.net/raw/c32185d26673e136eb3dc2371c9b6236/
c32185d26673e136eb3dc2371c9b6236
bash
Bash
3
2016-12-02T13:44:20
True
False
False
/api/public/snipt/11230/
repository-rpm
<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="c1">#repository listing</span> </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a>rpm -qa </span></pre></div> </td></tr></table>
"repository list", rpm

Bash

Extract Source from RPM

1
2
3
4
mkdir test
cd test
wget http://mysite.com/files/packages/appp-1.0.x86_64.rpm
rpm2cpio appp-1.0.x86_64.rpm | cpio -idmv
https://snipt.net/embed/3892353baced23ad40d4f5fdcfff3668/
https://snipt.net/raw/3892353baced23ad40d4f5fdcfff3668/
3892353baced23ad40d4f5fdcfff3668
bash
Bash
4
2016-12-08T12:25:59
True
False
False
/api/public/snipt/5570/
extract-source-from-rpm
<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>mkdir <span class="nb">test</span> </span><span id="L-2"><a name="L-2"></a><span class="nb">cd</span> <span class="nb">test</span> </span><span id="L-3"><a name="L-3"></a>wget http://mysite.com/files/packages/appp-1.0.x86_64.rpm </span><span id="L-4"><a name="L-4"></a>rpm2cpio appp-1.0.x86_64.rpm <span class="p">|</span> cpio -idmv </span></pre></div> </td></tr></table>
bash, centos, linux, redhat, rpm

Bash

Rpm permissions

1
2
3
# Have you managed to completely mess up file permissions for a given package? Not a problem, because RPM has you covered.

rpm --setperms <packagename>
https://snipt.net/embed/d9cd0ca2b7d9307d8df248f2721c7a6c/
https://snipt.net/raw/d9cd0ca2b7d9307d8df248f2721c7a6c/
d9cd0ca2b7d9307d8df248f2721c7a6c
bash
Bash
3
2016-12-09T09:43:14
True
False
False
/api/public/snipt/5480/
rpm-permissions
<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="c1"># Have you managed to completely mess up file permissions for a given package? Not a problem, because RPM has you covered.</span> </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a>rpm --setperms &lt;packagename&gt; </span></pre></div> </td></tr></table>
permissions, rpm

Bash

View the Package Changelog

1
2
3
4
5
6
7
# View the Changelog

# Because CentOS and the upstream vendor have backported security patches, the version numbers can often be misleading when you look for CVE fixes. Checking the changelog of a package is a good way to see if the fix has been implemented. Once again, rpm comes to the rescue.

rpm -q --changelog <packagename> | less

# Using less isn't necessary, but for some packages like the kernel, the changelog can be quite long. Using less helps to make things more readable. 
https://snipt.net/embed/c9e19e153aa715cd60329db257425d0f/
https://snipt.net/raw/c9e19e153aa715cd60329db257425d0f/
c9e19e153aa715cd60329db257425d0f
bash
Bash
7
2016-12-04T22:22:44
True
False
False
/api/public/snipt/5479/
view-the-package-changelog
<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></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1"># View the Changelog</span> </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a><span class="c1"># Because CentOS and the upstream vendor have backported security patches, the version numbers can often be misleading when you look for CVE fixes. Checking the changelog of a package is a good way to see if the fix has been implemented. Once again, rpm comes to the rescue.</span> </span><span id="L-4"><a name="L-4"></a> </span><span id="L-5"><a name="L-5"></a>rpm -q --changelog &lt;packagename&gt; <span class="p">|</span> less </span><span id="L-6"><a name="L-6"></a> </span><span id="L-7"><a name="L-7"></a><span class="c1"># Using less isn&#39;t necessary, but for some packages like the kernel, the changelog can be quite long. Using less helps to make things more readable. </span> </span></pre></div> </td></tr></table>
package, packages, rpm

Bash

Query Package Install Order and Dates

1
2
3
4
5
6
# Query Package Install Order and Dates 
# Useful after an upgrade to find old packages that were not upgraded.

rpm -qa --last >~/RPMS_by_Install_Date

# Review the end of the output file in "less" to find all RPMS older than the install date. Can also grep for specific packages and see when they were installed. 
https://snipt.net/embed/fd6c741397ac9c342ccb09539bd55d5d/
https://snipt.net/raw/fd6c741397ac9c342ccb09539bd55d5d/
fd6c741397ac9c342ccb09539bd55d5d
bash
Bash
6
2016-12-07T21:52:42
True
False
False
/api/public/snipt/5478/
query-package-install-order-and-dates
<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><span class="c1"># Query Package Install Order and Dates </span> </span><span id="L-2"><a name="L-2"></a><span class="c1"># Useful after an upgrade to find old packages that were not upgraded.</span> </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a>rpm -qa --last &gt;~/RPMS_by_Install_Date </span><span id="L-5"><a name="L-5"></a> </span><span id="L-6"><a name="L-6"></a><span class="c1"># Review the end of the output file in &quot;less&quot; to find all RPMS older than the install date. Can also grep for specific packages and see when they were installed. </span> </span></pre></div> </td></tr></table>
packages, query, rpm
Copyrighted, illegal, or inappropriate content? Email [email protected].