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/
https://snipt.net/raw/0bf8d894f6ead618ac4cf860825e6a34/
0bf8d894f6ead618ac4cf860825e6a34
bash
Bash
2
2016-09-27T07:59:12
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 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

bugfix "Could not load host key /etc/ssh/ssh_host_..."

1
2
3
# error: Could not load host key: /etc/ssh/ssh_host_ed25519_key
# Regenerates any missing keys:
$ ssh-keygen -A
https://snipt.net/embed/6ac532ae5b57a28cfd810f876f7bb91f/
https://snipt.net/raw/6ac532ae5b57a28cfd810f876f7bb91f/
6ac532ae5b57a28cfd810f876f7bb91f
bash
Bash
4
2016-09-24T05:17:50
True
False
False
Feb 03, 2015 at 11:54 PM
/api/public/snipt/138107/
bugfix-could-not-load-host-key-etcsshssh_host_-7f87c683
<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 id="L-1"><a name="L-1"></a><span class="c"># error: Could not load host key: /etc/ssh/ssh_host_ed25519_key</span> </span><span id="L-2"><a name="L-2"></a><span class="c"># Regenerates any missing keys:</span> </span><span id="L-3"><a name="L-3"></a><span class="nv">$ </span>ssh-keygen -A </span></pre></div> </td></tr></table>
aws, linux, ssh, ssh-keygen, ubuntu

Bash

linux > check if username exists

$ id -u name
https://snipt.net/embed/067c62975fc052fa0821b7b3ae80a4c5/
https://snipt.net/raw/067c62975fc052fa0821b7b3ae80a4c5/
067c62975fc052fa0821b7b3ae80a4c5
bash
Bash
1
2016-09-27T07:59:12
True
False
False
Feb 03, 2015 at 07:45 PM
/api/public/snipt/138039/
linux-check-if-username-exists-bc795ca7
<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 id="L-1"><a name="L-1"></a><span class="nv">$ </span>id -u name </span></pre></div> </td></tr></table>
bash, linux, ubuntu

Bash Session

Actualizar kernel en Ubuntu

1
2
3
4
5
6
7
8
#Mirar versión de kernel instalado.
uname -a
#Bajamos los paquetes necesarios correspondiente a la arquitectura de nuestro procesador.
http://kernel.ubuntu.com/~kernel-ppa/mainline
#Instalamos el nuevo kernel.
sudo dpkg -i linux*.deb
#Actualizamos el grub.
sudo update-grub
https://snipt.net/embed/9b5870776571bf6873c805471e2fae21/
https://snipt.net/raw/9b5870776571bf6873c805471e2fae21/
9b5870776571bf6873c805471e2fae21
console
Bash Session
8
2016-09-26T17:36:22
True
False
False
/api/public/snipt/128920/
actualizar-kernel-en-ubuntu
<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 id="L-1"><a name="L-1"></a><span class="gp">#</span>Mirar versión de kernel instalado. </span><span id="L-2"><a name="L-2"></a><span class="go">uname -a</span> </span><span id="L-3"><a name="L-3"></a><span class="gp">#</span>Bajamos los paquetes necesarios correspondiente a la arquitectura de nuestro procesador. </span><span id="L-4"><a name="L-4"></a><span class="go">http://kernel.ubuntu.com/~kernel-ppa/mainline</span> </span><span id="L-5"><a name="L-5"></a><span class="gp">#</span>Instalamos el nuevo kernel. </span><span id="L-6"><a name="L-6"></a><span class="go">sudo dpkg -i linux*.deb</span> </span><span id="L-7"><a name="L-7"></a><span class="gp">#</span>Actualizamos el grub. </span><span id="L-8"><a name="L-8"></a><span class="go">sudo update-grub</span> </span></pre></div> </td></tr></table>
kernel, linux, ubuntu

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-09-25T19:10:22
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 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="c"># 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="c"># 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

Text only

simulate slow bandwith on linux systems

1
2
3
4
5
6
7
//Simulate slow internet connections eg for mobile devices
//Testet on Ubuntu

#sudo apt-get install trickle
#trickle -s -d 50 -w 100 firefox

The -s tells the command to run standalone, the -d 50 tells it to limit bandwidth to 50 KB/s, the -w 100 set the peak detection window size to 100 KB. firefox tells the command to start firefox with all of this rate limiting applied to any sites it attempts to load.
https://snipt.net/embed/83ed0d5843441ae7d48f4ffef70dba43/
https://snipt.net/raw/83ed0d5843441ae7d48f4ffef70dba43/
83ed0d5843441ae7d48f4ffef70dba43
text
Text only
7
2016-09-26T05:02:05
True
False
False
Nov 20, 2013 at 10:29 AM
/api/public/snipt/95535/
simulate-slow-bandwith-on-linux-systems
<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 id="L-1"><a name="L-1"></a>//Simulate slow internet connections eg for mobile devices </span><span id="L-2"><a name="L-2"></a>//Testet on Ubuntu </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a>#sudo apt-get install trickle </span><span id="L-5"><a name="L-5"></a>#trickle -s -d 50 -w 100 firefox </span><span id="L-6"><a name="L-6"></a> </span><span id="L-7"><a name="L-7"></a>The -s tells the command to run standalone, the -d 50 tells it to limit bandwidth to 50 KB/s, the -w 100 set the peak detection window size to 100 KB. firefox tells the command to start firefox with all of this rate limiting applied to any sites it attempts to load. </span></pre></div> </td></tr></table>
ubuntu
Copyrighted, illegal, or inappropriate content? Email support@snipt.net.