snipt

Ctrl+h for KB shortcuts
#128920

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
2014-04-16T02:47:19
True
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
#126790

Bash

Commands to change server's files and folders to 664 and 775 permissions

find /path/to/folder/ -type f -exec chmod 664 {} \;
find /path/to/folder/ -type d -exec chmod 775 {} \;
https://snipt.net/embed/b9cc0a6f29db6919af50cd3cf092a717/
https://snipt.net/raw/b9cc0a6f29db6919af50cd3cf092a717/
b9cc0a6f29db6919af50cd3cf092a717
bash
Bash
2
2014-04-08T21:39:59
True
True
Apr 02, 2014 at 12:12 PM
/api/public/snipt/126790/
commands-to-change-servers-files-and-folders-to-664-and-775-permissions
<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>find /path/to/folder/ -type f -exec chmod 664 <span class="o">{}</span> <span class="se">\;</span> </span><span id="L-2"><a name="L-2"></a>find /path/to/folder/ -type d -exec chmod 775 <span class="o">{}</span> <span class="se">\;</span> </span></pre></div> </td></tr></table>
664, 775, linux, server
#124795

Shell Session

Comando para verificar ataques DoS - linux

#Identifica las Ips conectadas las ordena y cuenta la cantidad de conexiones que tiene cada una
netstat -atun | awk '{print $5}' | cut -d: -f1 | sed -e '/^$/d' |sort | uniq -c | sort -n
https://snipt.net/embed/9196ff1e7b6bd70b4878f04a73db7cd7/
https://snipt.net/raw/9196ff1e7b6bd70b4878f04a73db7cd7/
9196ff1e7b6bd70b4878f04a73db7cd7
shell-session
Shell Session
2
2014-04-12T01:54:14
True
True
Mar 25, 2014 at 07:01 PM
/api/public/snipt/124795/
comando-para-verificar-ataques-dos-linux
<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="go">#Identifica las Ips conectadas las ordena y cuenta la cantidad de conexiones que tiene cada una</span> </span><span id="L-2"><a name="L-2"></a><span class="go">netstat -atun | awk &#39;{print $5}&#39; | cut -d: -f1 | sed -e &#39;/^$/d&#39; |sort | uniq -c | sort -n</span> </span></pre></div> </td></tr></table>
DoS, linux, shellscript
#122719

Text only

Linux renice all java processes

ps fax | grep java | awk '{print $1;}' | xargs renice -n 19
https://snipt.net/embed/d8118159753138d887723bfd65b14f1e/
https://snipt.net/raw/d8118159753138d887723bfd65b14f1e/
d8118159753138d887723bfd65b14f1e
text
Text only
1
2014-04-16T03:40:46
True
False
Mar 18, 2014 at 06:33 AM
/api/public/snipt/122719/
linux-renice-all-java-processes
<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>ps fax | grep java | awk &#39;{print $1;}&#39; | xargs renice -n 19 </span></pre></div> </td></tr></table>
java, linux, renice
#115399

Text only

Zip a Folder in Linux

zip -9 -r <zip_file_name> <folder_name>
https://snipt.net/embed/f38874c4a765cfa9a855b8f1dbf36fea/
https://snipt.net/raw/f38874c4a765cfa9a855b8f1dbf36fea/
f38874c4a765cfa9a855b8f1dbf36fea
text
Text only
1
2014-04-16T12:11:12
True
False
Feb 20, 2014 at 04:25 AM
/api/public/snipt/115399/
zip-a-folder-in-linux-1
<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>zip -9 -r &lt;zip_file_name&gt; &lt;folder_name&gt; </span></pre></div> </td></tr></table>
linux, zip
#108837

Text only

Cahnge owner group for all files

chown -R web37:client9 *
https://snipt.net/embed/07e4c73bd7f40bda0d1d1620fbe7ced5/
https://snipt.net/raw/07e4c73bd7f40bda0d1d1620fbe7ced5/
07e4c73bd7f40bda0d1d1620fbe7ced5
text
Text only
1
2014-04-15T02:45:46
True
False
Jan 27, 2014 at 11:36 AM
/api/public/snipt/108837/
cahnge-owner-group-for-all-files
<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>chown -R web37:client9 * </span></pre></div> </td></tr></table>
Linux, linux
#102129

Bash

linux 10 largest files on folder

du -hsx * | sort -rh | head -10
https://snipt.net/embed/d0a999c2ea84cd11eb72be963e5d2c3c/
https://snipt.net/raw/d0a999c2ea84cd11eb72be963e5d2c3c/
d0a999c2ea84cd11eb72be963e5d2c3c
bash
Bash
1
2014-04-15T11:30:15
True
False
Dec 23, 2013 at 05:01 AM
/api/public/snipt/102129/
linux-10-largest-files-on-folder
<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>du -hsx * <span class="p">|</span> sort -rh <span class="p">|</span> head -10 </span></pre></div> </td></tr></table>
"linux commands", linux