snipt

Ctrl+h for KB shortcuts

Text only

"Too many open files" solution

1
2
3
4
5
6
7
1. In /etc/security/limits.conf 
* soft nofile 10000
* hard nofile 65535
2. Increase ulimit by "ulimit -n 65535"
3. echo 65535 > /proc/sys/fs/file-max
4. In /etc/sysctl.conf 
fs.file-max=65535
https://snipt.net/embed/75876659ef79e4cc8a4e6e38cd108264/
/raw/75876659ef79e4cc8a4e6e38cd108264/
75876659ef79e4cc8a4e6e38cd108264
text
Text only
7
2019-06-13T22:31:59
True
False
False
/api/public/snipt/27936/
too-many-open-files-solution
<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>1. In /etc/security/limits.conf </span><span id="L-2"><a name="L-2"></a>* soft nofile 10000 </span><span id="L-3"><a name="L-3"></a>* hard nofile 65535 </span><span id="L-4"><a name="L-4"></a>2. Increase ulimit by &quot;ulimit -n 65535&quot; </span><span id="L-5"><a name="L-5"></a>3. echo 65535 &gt; /proc/sys/fs/file-max </span><span id="L-6"><a name="L-6"></a>4. In /etc/sysctl.conf </span><span id="L-7"><a name="L-7"></a>fs.file-max=65535 </span></pre></div> </td></tr></table>
bash, debian, files, linux, many, too, ubuntu

Bash

apt-get resolve gpg keys

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys $KEY
https://snipt.net/embed/fe6c97954927fe10fad29180c13cbf77/
/raw/fe6c97954927fe10fad29180c13cbf77/
fe6c97954927fe10fad29180c13cbf77
bash
Bash
2
2019-06-11T16:14:50
True
False
False
/api/public/snipt/20155/
apt-get-resolve-gpg-keys
<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-key adv --keyserver keyserver.ubuntu.com --recv-keys <span class="nv">$KEY</span> </span></pre></div> </td></tr></table>
apt-get, debian, gpg, keys, ubuntu

Debian Sourcelist

Debian SourceList

deb http://security.debian.org/ lenny/updates main
deb http://ftp.debian.org/debian lenny main contrib non-free
https://snipt.net/embed/7dd2e6dd734764d9f74178e07c318ea0/
/raw/7dd2e6dd734764d9f74178e07c318ea0/
7dd2e6dd734764d9f74178e07c318ea0
sourceslist
Debian Sourcelist
2
2019-06-09T16:01:22
True
False
False
/api/public/snipt/8510/
debian-sourcelist
<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="k">deb</span> <span class="s">http://security.debian.org/</span> <span class="kp">lenny/updates</span> <span class="kp">main</span> </span><span id="L-2"><a name="L-2"></a><span class="k">deb</span> <span class="s">http://ftp.debian.org/debian</span> <span class="kp">lenny</span> <span class="kp">main</span> <span class="kp">contrib</span> <span class="kp">non-free</span> </span></pre></div> </td></tr></table>
apt, debian, source

Bash

Install VMWare Tools on Debian

1
2
3
4
5
# Make sure you have contrib and non-free in /etc/apt/sources.list
# Then:

apt-get install module-assistant
m-a a-i open-vm
https://snipt.net/embed/116fd929cfe58fdab62909700bc896ef/
/raw/116fd929cfe58fdab62909700bc896ef/
116fd929cfe58fdab62909700bc896ef
bash
Bash
5
2019-06-01T00:06:41
True
False
False
/api/public/snipt/6408/
install-vmware-tools-on-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></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1"># Make sure you have contrib and non-free in /etc/apt/sources.list</span> </span><span id="L-2"><a name="L-2"></a><span class="c1"># Then:</span> </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a>apt-get install module-assistant </span><span id="L-5"><a name="L-5"></a>m-a a-i open-vm </span></pre></div> </td></tr></table>
admin, debian, linux, server, vmware

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

Text only

set apt-cacher proxy and temporarily disable it

1
2
3
4
5
6
7
In this example an apt-cacher proxy is running on the server at 192.168.0.2.

---- /etc/apt/apt.conf.d/01proxy:
Acquire::http::Proxy "http://192.168.0.2:3142/apt-cacher/";

Bypassing the proxy temporarily:
# apt-get install -o Acquire::http::Proxy=none ack-grep
https://snipt.net/embed/89385dbb43fd8fd9161e08100f3885f0/
/raw/89385dbb43fd8fd9161e08100f3885f0/
89385dbb43fd8fd9161e08100f3885f0
text
Text only
7
2019-06-13T03:29:24
True
False
False
/api/public/snipt/6260/
set-apt-cacher-proxy-and-temporarily-disable-it
<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>In this example an apt-cacher proxy is running on the server at 192.168.0.2. </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a>---- /etc/apt/apt.conf.d/01proxy: </span><span id="L-4"><a name="L-4"></a>Acquire::http::Proxy &quot;http://192.168.0.2:3142/apt-cacher/&quot;; </span><span id="L-5"><a name="L-5"></a> </span><span id="L-6"><a name="L-6"></a>Bypassing the proxy temporarily: </span><span id="L-7"><a name="L-7"></a># apt-get install -o Acquire::http::Proxy=none ack-grep </span></pre></div> </td></tr></table>
apt, debian, ubuntu

Bash

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

apt-get install wajig
wajig hold <package_name>
https://snipt.net/embed/ee48f3dcee921701c3b6eb703f9fb31e/
/raw/ee48f3dcee921701c3b6eb703f9fb31e/
ee48f3dcee921701c3b6eb703f9fb31e
bash
Bash
2
2019-06-11T14:44:55
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/
/raw/8eff9d1fde7c40dd7062916beca63dd0/
8eff9d1fde7c40dd7062916beca63dd0
bash
Bash
3
2019-06-12T09:14:13
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