<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule">

<channel>
	<title>Jompeich d'er Bisente &#187; Command Line</title>
	<atom:link href="http://www.bisente.com/blog/category/linuxadas/command-line/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bisente.com</link>
	<description>Este es mi blog. Hay otros muchos pero este es el mío.</description>
	<pubDate>Tue, 02 Dec 2008 23:21:47 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
	<language>en</language>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc/2.5/es/</creativeCommons:license>		<item>
		<title>mpstat</title>
		<link>http://www.bisente.com/blog/2008/09/25/mpstat/</link>
		<comments>http://www.bisente.com/blog/2008/09/25/mpstat/#comments</comments>
		<pubDate>Thu, 25 Sep 2008 19:00:05 +0000</pubDate>
		<dc:creator>bisente</dc:creator>
		
		<category><![CDATA[Command Line]]></category>

		<category><![CDATA[English]]></category>

		<category><![CDATA[Linuxadas]]></category>

		<category><![CDATA[Cacti]]></category>

		<category><![CDATA[cpu]]></category>

		<category><![CDATA[HyperThreading]]></category>

		<category><![CDATA[monitorización]]></category>

		<category><![CDATA[mpstat]]></category>

		<category><![CDATA[Nagios]]></category>

		<category><![CDATA[recursos]]></category>

		<category><![CDATA[sistemas]]></category>

		<category><![CDATA[sysstat]]></category>

		<category><![CDATA[top]]></category>

		<category><![CDATA[vmstat]]></category>

		<guid isPermaLink="false">http://www.bisente.com/?p=653</guid>
		<description><![CDATA[<!-- google_ad_section_start --><p>[spanish]</p>
<p>Al monitorizar un sistema, una de las variables más básicas a observar es el consumo de CPU, algo que típicamente haremos con <a href="http://linux.die.net/man/1/top" title="top" onclick="javascript:pageTracker._trackPageview ('/outbound/linux.die.net');">top</a> de forma interactiva o con <a href="http://es.tldp.org/Paginas-manual/man-pages-es-extra-0.8a/man8/vmstat.8.html" title="vmstat" onclick="javascript:pageTracker._trackPageview ('/outbound/es.tldp.org');">vmstat</a> si queremos automatizar el proceso.</p>
<p>El problema viene al tratar con un sistema con más de una CPU (física o virtual), ya que en este caso vmstat mostrará la media de todas las CPUs. Dependiendo de la arquitectura hardware y/o software nos podemos encontrar con cuellos de botella o bloqueos en el momento que una de las CPUs esté al 100% aunque la otra esté completamente libre, caso en el que vmstat indicaría un 50% idle. Es una situación típica en equipos con una única CPU física pero con <a href="http://es.wikipedia.org/wiki/HyperThreading" title="HyperThreading" onclick="javascript:pageTracker._trackPageview ('/outbound/es.wikipedia.org');">HyperThreading</a>.</p>
<p>Una alternativa a vmstat en estos casos es <a href="http://www.linuxcommand.org/man_pages/mpstat1.html" title="mpstat" onclick="javascript:pageTracker._trackPageview ('/outbound/www.linuxcommand.org');">mpstat</a>, del paquete <a href="http://www.google.es/url?sa=t&amp;source=web&amp;ct=res&amp;cd=1&amp;url=http%3A%2F%2Fpagesperso-orange.fr%2Fsebastien.godard%2F&amp;ei=_9nbSNTtO4760QSR2pSNBA&amp;usg=AFQjCNFGEM0dpUUFwrjN0cIpw9H-PPGmUA&amp;sig2=wayQoLVKYjQXovxWxus1IQ" title="sysstat" onclick="javascript:pageTracker._trackPageview ('/outbound/www.google.es');">sysstat</a>, que muestra el consumo por CPU de forma independiente. Imprescindible p.ej. a la hora de escribir un script para hacer gráficas con <a href="http://www.cacti.net/" title="Cacti" onclick="javascript:pageTracker._trackPageview ('/outbound/www.cacti.net');">Cacti</a> o lanzar alertas con <a href="http://www.nagios.org/" title="Nagios" onclick="javascript:pageTracker._trackPageview ('/outbound/www.nagios.org');">Nagios</a>.</p>
<p>[/spanish][english]</p>
<p>One of the most basic variables to monitor on a system is CPU usage, something we usually do interactively with <a href="http://linux.die.net/man/1/top" title="top" onclick="javascript:pageTracker._trackPageview ('/outbound/linux.die.net');">top</a> or with <a href="http://es.tldp.org/Paginas-manual/man-pages-es-extra-0.8a/man8/vmstat.8.html" title="vmstat" onclick="javascript:pageTracker._trackPageview ('/outbound/es.tldp.org');">vmstat</a> when we want to script the process.</p>
<p>But there&#8217;s a problem with multi-CPU systems, with either physical or virtual CPUs, because in these cases vmstat shows the average usage across all CPUs. Depending on the software or hardware architecture, a CPU at 100% can become a bottleneck and produce process blockings ever if the other CPUs are completely idle, while vmstat would show us just a 50% CPU usage. This is quite typical with single CPU systems with <a href="http://en.wikipedia.org/wiki/HyperThreading" title="HyperThreading" onclick="javascript:pageTracker._trackPageview ('/outbound/en.wikipedia.org');">HyperThreading</a> technology.</p>
<p>An alternative to vmstat for these situations is <a href="http://www.linuxcommand.org/man_pages/mpstat1.html" title="mpstat" onclick="javascript:pageTracker._trackPageview ('/outbound/www.linuxcommand.org');">mpstat</a>, from the <a href="http://www.google.es/url?sa=t&amp;source=web&amp;ct=res&amp;cd=1&amp;url=http%3A%2F%2Fpagesperso-orange.fr%2Fsebastien.godard%2F&amp;ei=_9nbSNTtO4760QSR2pSNBA&amp;usg=AFQjCNFGEM0dpUUFwrjN0cIpw9H-PPGmUA&amp;sig2=wayQoLVKYjQXovxWxus1IQ" title="sysstat" onclick="javascript:pageTracker._trackPageview ('/outbound/www.google.es');">sysstat</a> package, that shows the individual per-CPU usage rates. Very useful when writing a script for displaying graphs with <a href="http://www.cacti.net/" title="Cacti" onclick="javascript:pageTracker._trackPageview ('/outbound/www.cacti.net');">Cacti</a> or raising alarms with <a href="http://www.nagios.org/" title="Nagios" onclick="javascript:pageTracker._trackPageview ('/outbound/www.nagios.org');">Nagios</a>.</p>
<p>[/english]</p>
<pre># mpstat -P ALL
Linux 2.6.9-023stab046.2-enterprise (domain.com) 	25/09/08
20:39:02     CPU   %user   %nice %system %iowait    %irq   %soft   %idle    intr/s
20:39:02     all    0,79    0,00    0,17    5,74    0,00    0,00   93,30      0,00
20:39:02       0    0,87    0,01    0,19    6,85    0,00    0,00   92,09      0,00
20:39:02       1    0,87    0,00    0,18    5,94    0,00    0,00   93,00      0,00
20:39:02       2    0,74    0,00    0,16    5,14    0,00    0,00   93,96      0,00
20:39:02       3    0,68    0,00    0,16    5,02    0,00    0,00   94,15      0,00</pre>
<h3>Artículos relacionados (o no):</h3>
<ul class="related_post">
<li><a href="http://www.bisente.com/blog/2008/09/22/iostat-iotop-io-debugging/" title="iostat &amp; iotop: I/O debugging">iostat &amp; iotop: I/O debugging</a></li>
<li><a href="http://www.bisente.com/blog/2008/02/11/shell-script-timestamp/" title="Shell-script: timestamp">Shell-script: timestamp</a></li>
<li><a href="http://www.bisente.com/blog/2007/11/30/picos-de-cpu-raros-en-leopard/" title="[spanish]Picos de CPU raros en Leopard[/spanish][english]Weird CPU load spikes on Leopard[/english]">[spanish]Picos de CPU raros en Leopard[/spanish][english]Weird CPU load spikes on Leopard[/english]</a></li>
</ul>
<!-- google_ad_section_end -->
<div class="sociable">
<div class="sociable_tagline">
<strong>Enviar a:</strong>
</div>
<ul>
	<li><a rel="nofollow" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F09%2F25%2Fmpstat%2F&amp;title=mpstat" title="Digg"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://sphinn.com/submit.php?url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F09%2F25%2Fmpstat%2F&amp;title=mpstat" title="Sphinn"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F09%2F25%2Fmpstat%2F&amp;title=mpstat" title="del.icio.us"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F09%2F25%2Fmpstat%2F&amp;t=mpstat" title="Facebook"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F09%2F25%2Fmpstat%2F&amp;title=mpstat" title="Mixx"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F09%2F25%2Fmpstat%2F&amp;title=mpstat" title="Google"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://barrapunto.com/submit.pl?subj=mpstat&amp;story=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F09%2F25%2Fmpstat%2F" title="BarraPunto"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/barrapunto.png" title="BarraPunto" alt="BarraPunto" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://meneame.net/submit.php?url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F09%2F25%2Fmpstat%2F" title="Meneame"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/meneame.gif" title="Meneame" alt="Meneame" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://slashdot.org/bookmark.pl?title=mpstat&amp;url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F09%2F25%2Fmpstat%2F" title="Slashdot"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F09%2F25%2Fmpstat%2F" title="Technorati"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F09%2F25%2Fmpstat%2F&amp;=mpstat" title="YahooMyWeb"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/yahoomyweb.png" title="YahooMyWeb" alt="YahooMyWeb" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></description>
		<wfw:commentRss>http://www.bisente.com/blog/2008/09/25/mpstat/feed/</wfw:commentRss>
		</item>
		<item>
		<title>iostat &#38; iotop: I/O debugging</title>
		<link>http://www.bisente.com/blog/2008/09/22/iostat-iotop-io-debugging/</link>
		<comments>http://www.bisente.com/blog/2008/09/22/iostat-iotop-io-debugging/#comments</comments>
		<pubDate>Mon, 22 Sep 2008 16:22:26 +0000</pubDate>
		<dc:creator>bisente</dc:creator>
		
		<category><![CDATA[Command Line]]></category>

		<category><![CDATA[English]]></category>

		<category><![CDATA[bottleneck]]></category>

		<category><![CDATA[cuello de botella]]></category>

		<category><![CDATA[debug]]></category>

		<category><![CDATA[disco]]></category>

		<category><![CDATA[I/O]]></category>

		<category><![CDATA[ifstat]]></category>

		<category><![CDATA[iostat]]></category>

		<category><![CDATA[iotop]]></category>

		<category><![CDATA[raid]]></category>

		<category><![CDATA[vmstat]]></category>

		<guid isPermaLink="false">http://www.bisente.com/?p=636</guid>
		<description><![CDATA[<!-- google_ad_section_start --><p>[spanish]</p>
<p>Hace unos meses tuvimos un caso raro en un cliente: una aplicación no daba el rendimiento que debería, sin embargo más del 20% de CPU estaba en estado &#8220;idle&#8221; y no se había tocado la swap, por lo que no era por falta de recursos. Fijándonos mejor en los porcentajes de CPU que daba <a href="http://es.tldp.org/Paginas-manual/man-pages-es-extra-0.8a/man8/vmstat.8.html" title="vmstat" onclick="javascript:pageTracker._trackPageview ('/outbound/es.tldp.org');">vmstat</a>, vimos que alrededor del 30% estaba en I/O, por lo que el problema era un cuello de botella en entrada/salida.</p>
<p>Para averiguar la causa utilizamos dos programas:</p>
<ul>
<li><a href="http://www.linuxquestions.org/linux/articles/Jeremys_Magazine_Articles/Hunting_I_O_Bottlenecks_with_iostat" title="iostat" onclick="javascript:pageTracker._trackPageview ('/outbound/www.linuxquestions.org');">iostat</a> (viene en el paquete <a href="http://pagesperso-orange.fr/sebastien.godard/" title="sysstat" onclick="javascript:pageTracker._trackPageview ('/outbound/pagesperso-orange.fr');">sysstat</a>): similar a <a href="http://es.tldp.org/Paginas-manual/man-pages-es-extra-0.8a/man8/vmstat.8.html" title="vmstat" onclick="javascript:pageTracker._trackPageview ('/outbound/es.tldp.org');">vmstat</a> o <a href="http://www.bisente.com/blog/2008/02/07/ifstat/" title="ifstat">ifstat</a>, pero para operaciones de I/O. Muestra por dispositivo y por partición, cada X segundos, la cantidad de bloques leídos/escritos.</li>
<li><a href="http://guichaz.free.fr/iotop/" title="iotop" onclick="javascript:pageTracker._trackPageview ('/outbound/guichaz.free.fr');">iotop</a>: como el top de toda la vida, pero ordena los procesos por consumo de I/O.</li>
</ul>
<p>Con ayuda de éstas dos utilidades es fácil detectar qué programa está causando el cuello de botella, y en qué dispositivo.</p>
<p>En nuestro caso, el problema era una controladora RAID hardware que estaba dando muy mal rendimiento de escritura, unida a un programa que realizaba del orden de 15 pequeñas escrituras aleatorias por segundo.</p>
<p>[/spanish]</p>
<p>[english]</p>
<p>A couple of months ago, we had an interesting issue at a customer: an application wasn&#8217;t performing well, but the system had more than 20% CPU idle and wasn&#8217;t swapping memory, so it wasn&#8217;t a lack of resources. After a deeper look into <a href="http://es.tldp.org/Paginas-manual/man-pages-es-extra-0.8a/man8/vmstat.8.html" title="vmstat" onclick="javascript:pageTracker._trackPageview ('/outbound/es.tldp.org');">vmstat</a>, we saw a constant 30% of CPU in I/O state. We had some kind of I/O bottleneck.</p>
<p>To discover the root of the issue we used two programs:</p>
<ul>
<li><a href="http://www.linuxquestions.org/linux/articles/Jeremys_Magazine_Articles/Hunting_I_O_Bottlenecks_with_iostat" title="iostat" onclick="javascript:pageTracker._trackPageview ('/outbound/www.linuxquestions.org');">iostat</a> (comes with the <a href="http://pagesperso-orange.fr/sebastien.godard/" title="sysstat" onclick="javascript:pageTracker._trackPageview ('/outbound/pagesperso-orange.fr');">sysstat</a> package): similar to <a href="http://es.tldp.org/Paginas-manual/man-pages-es-extra-0.8a/man8/vmstat.8.html" title="vmstat" onclick="javascript:pageTracker._trackPageview ('/outbound/es.tldp.org');">vmstat</a> or <a href="http://www.bisente.com/blog/2008/02/07/ifstat/" title="ifstat">ifstat</a>, but shows I/O operations per device and partition, updating its output every X seconds.</li>
<li><a href="http://guichaz.free.fr/iotop/" title="iotop" onclick="javascript:pageTracker._trackPageview ('/outbound/guichaz.free.fr');">iotop</a>: like the classic top, sorting the processes according to their I/O rate.</li>
</ul>
<p>By using these two utilities it&#8217;s quite easy to discover which process is creating the I/O bottleneck, and on which particular device.</p>
<p>In our case, the problem was a RAID controller that was giving a terrible writing performance, coupled with a process that was doing around 15 small, random access writes per second.</p>
<p>[/english]<br />
<h3>Artículos relacionados (o no):</h3>
<ul class="related_post">
<li><a href="http://www.bisente.com/blog/2008/09/25/mpstat/" title="mpstat">mpstat</a></li>
<li><a href="http://www.bisente.com/blog/2008/02/11/shell-script-timestamp/" title="Shell-script: timestamp">Shell-script: timestamp</a></li>
<li><a href="http://www.bisente.com/blog/2008/02/09/liberar-espacio-extra-en-macos-x/" title="[spanish]Liberar espacio extra en MacOS X[/spanish][english]Reclaim some wasted HD on MacOS X[/english]">[spanish]Liberar espacio extra en MacOS X[/spanish][english]Reclaim some wasted HD on MacOS X[/english]</a></li>
<li><a href="http://www.bisente.com/blog/2007/12/27/redundancia-para-torpes/" title="[spanish]Redundancia para torpes[/spanish][english]Redundancy for dummies[/english]">[spanish]Redundancia para torpes[/spanish][english]Redundancy for dummies[/english]</a></li>
</ul>
<!-- google_ad_section_end -->
<div class="sociable">
<div class="sociable_tagline">
<strong>Enviar a:</strong>
</div>
<ul>
	<li><a rel="nofollow" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F09%2F22%2Fiostat-iotop-io-debugging%2F&amp;title=iostat%20%26amp%3B%20iotop%3A%20I%2FO%20debugging" title="Digg"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://sphinn.com/submit.php?url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F09%2F22%2Fiostat-iotop-io-debugging%2F&amp;title=iostat%20%26amp%3B%20iotop%3A%20I%2FO%20debugging" title="Sphinn"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F09%2F22%2Fiostat-iotop-io-debugging%2F&amp;title=iostat%20%26amp%3B%20iotop%3A%20I%2FO%20debugging" title="del.icio.us"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F09%2F22%2Fiostat-iotop-io-debugging%2F&amp;t=iostat%20%26amp%3B%20iotop%3A%20I%2FO%20debugging" title="Facebook"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F09%2F22%2Fiostat-iotop-io-debugging%2F&amp;title=iostat%20%26amp%3B%20iotop%3A%20I%2FO%20debugging" title="Mixx"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F09%2F22%2Fiostat-iotop-io-debugging%2F&amp;title=iostat%20%26amp%3B%20iotop%3A%20I%2FO%20debugging" title="Google"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://barrapunto.com/submit.pl?subj=iostat%20%26amp%3B%20iotop%3A%20I%2FO%20debugging&amp;story=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F09%2F22%2Fiostat-iotop-io-debugging%2F" title="BarraPunto"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/barrapunto.png" title="BarraPunto" alt="BarraPunto" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://meneame.net/submit.php?url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F09%2F22%2Fiostat-iotop-io-debugging%2F" title="Meneame"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/meneame.gif" title="Meneame" alt="Meneame" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://slashdot.org/bookmark.pl?title=iostat%20%26amp%3B%20iotop%3A%20I%2FO%20debugging&amp;url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F09%2F22%2Fiostat-iotop-io-debugging%2F" title="Slashdot"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F09%2F22%2Fiostat-iotop-io-debugging%2F" title="Technorati"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F09%2F22%2Fiostat-iotop-io-debugging%2F&amp;=iostat%20%26amp%3B%20iotop%3A%20I%2FO%20debugging" title="YahooMyWeb"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/yahoomyweb.png" title="YahooMyWeb" alt="YahooMyWeb" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></description>
		<wfw:commentRss>http://www.bisente.com/blog/2008/09/22/iostat-iotop-io-debugging/feed/</wfw:commentRss>
		</item>
		<item>
		<title>exec</title>
		<link>http://www.bisente.com/blog/2008/06/09/exec/</link>
		<comments>http://www.bisente.com/blog/2008/06/09/exec/#comments</comments>
		<pubDate>Mon, 09 Jun 2008 06:03:53 +0000</pubDate>
		<dc:creator>bisente</dc:creator>
		
		<category><![CDATA[Command Line]]></category>

		<category><![CDATA[English]]></category>

		<category><![CDATA[Linuxadas]]></category>

		<category><![CDATA[MacOS X]]></category>

		<category><![CDATA[daemontools]]></category>

		<category><![CDATA[bash]]></category>

		<category><![CDATA[exec]]></category>

		<category><![CDATA[fork]]></category>

		<category><![CDATA[Linux]]></category>

		<category><![CDATA[MacOS]]></category>

		<category><![CDATA[nice]]></category>

		<category><![CDATA[shell]]></category>

		<category><![CDATA[shell-script]]></category>

		<guid isPermaLink="false">http://www.bisente.com/blog/2008/06/09/exec/</guid>
		<description><![CDATA[<!-- google_ad_section_start --><p>[spanish]exec es un comando interno de la shell que fuerza a que un binario se ejecute sobre el propio proceso de la shell en vez de sobre un hijo.</p>
<p>Cuando en shell-script se invoca un comando, normalmente se crea un proceso hijo que lo ejecute. Esto a nivel de llamadas al sistema sería el típico:</p>
<pre>
<div class="codesnip-container" >if( (pid=fork()) == 0) {
    exec(command);
    exit();
}
wait();</div>
</pre>
<p>En general ésto es lo que queremos, para poder seguir ejecutando comandos en la shell. Sin embargo puede haber situaciones en las que no, casos típicos:</p>
<ul>
<li>tenemos un programa que va a monitorizar la ejecución de otro, y si hay un proceso shell por en medio no funciona bien, pero necesitamos esa shell para lo que sea (p.ej. preparar variables de entorno, ejecutar el comando con nice, etc.)</li>
<li>lanzamos un programa vía un shell-script en MacOS y en el dock salen dos iconos</li>
</ul>
<p>Con exec en lugar de hacer un fork que ejecute el comando, se ejecuta directamente sobre el proceso actual. Importante darse cuenta que, por lo tanto, cualquier comando que hubiera detrás del exec en la shell nunca se llega a ejecutar, pues el comando digamos que &#8220;suplanta&#8221; a la shell.</p>
<pre>
<div class="codesnip-container" >#!/bin/sh

#inicializar variables, parsear parámetros, etc.
export IP=$1

exec nice comando $*</div>
</pre>
<p>[/spanish]<br />
[english]<br />
exec is a built-in shell command that forces a binary to be executed by the currently running shell process instead of forking the process and running the binary on that child process.</p>
<p>When you run a command on a shell-script, it forks a child process and runs the command there. On a syscall level this is the classic:</p>
<pre>
<div class="codesnip-container" >if( (pid=fork()) == 0) {
    exec(command);
    exit();
}
wait();</div>
</pre>
<p>And this is usually what we want, because we will keep running commands after that one. Nevertheless, sometimes this is a problem, like when:</p>
<ul>
<li>we have a program that&#8217;s going to monitor a given process, and it doesn&#8217;t run properly if there&#8217;s an intermediate shell process but we need to run this second process via a shel-script for whatever reasons (to initialize some variables, run the program with nice, whatever)</li>
<li>on MacOS we&#8217;re running a program via a shell-script and get two icons on the dock, one for the shell and another one for the program</li>
</ul>
<p>Running a command with exec forces the shell not to fork, but to run the command directly over the shell process. An important thing to note here is that the shell-script will end there, no further commands of the shell script will be executed as the shell process will be substituted by the command process, so to speak.</p>
<pre>
<div class="codesnip-container" >#!/bin/sh

# initialize variables, parse command-line parameters, etc.
export IP=$1

exec nice command $*</div>
</pre>
<p>[/english]<br />
<h3>Artículos relacionados (o no):</h3>
<ul class="related_post">
<li><a href="http://www.bisente.com/blog/2008/02/11/shell-script-timestamp/" title="Shell-script: timestamp">Shell-script: timestamp</a></li>
<li><a href="http://www.bisente.com/blog/2008/10/28/crossover-de-gratis-y-otras-%c2%bfapuestas-%c2%bfo-marketing/" title="CrossOver de gratis y otras ¿apuestas? ¿o marketing?">CrossOver de gratis y otras ¿apuestas? ¿o marketing?</a></li>
<li><a href="http://www.bisente.com/blog/2008/04/26/mi-nuevo-servidor/" title="[spanish]Mi nuevo servidor[/spanish][english]My new server[/english]">[spanish]Mi nuevo servidor[/spanish][english]My new server[/english]</a></li>
<li><a href="http://www.bisente.com/blog/2008/02/18/broadcom-wireless-en-linux/" title="[spanish]Broadcom Wireless en Linux[/spanish][english]Broadcom Wireless on Linux[/english]">[spanish]Broadcom Wireless en Linux[/spanish][english]Broadcom Wireless on Linux[/english]</a></li>
<li><a href="http://www.bisente.com/blog/2008/02/16/new-title-in-spanish-4/" title="Shell-script: substrings">Shell-script: substrings</a></li>
<li><a href="http://www.bisente.com/blog/2008/02/07/ifstat/" title="ifstat">ifstat</a></li>
<li><a href="http://www.bisente.com/blog/2008/02/07/command-line/" title="Command Line">Command Line</a></li>
<li><a href="http://www.bisente.com/blog/2008/01/04/servidor-vnc-para-macos-x/" title="[spanish]Servidor VNC para MacOS X[/spanish][english]MacOS X VNC Server[/english]">[spanish]Servidor VNC para MacOS X[/spanish][english]MacOS X VNC Server[/english]</a></li>
</ul>
<!-- google_ad_section_end -->
<div class="sociable">
<div class="sociable_tagline">
<strong>Enviar a:</strong>
</div>
<ul>
	<li><a rel="nofollow" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F06%2F09%2Fexec%2F&amp;title=exec" title="Digg"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://sphinn.com/submit.php?url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F06%2F09%2Fexec%2F&amp;title=exec" title="Sphinn"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F06%2F09%2Fexec%2F&amp;title=exec" title="del.icio.us"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F06%2F09%2Fexec%2F&amp;t=exec" title="Facebook"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F06%2F09%2Fexec%2F&amp;title=exec" title="Mixx"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F06%2F09%2Fexec%2F&amp;title=exec" title="Google"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://barrapunto.com/submit.pl?subj=exec&amp;story=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F06%2F09%2Fexec%2F" title="BarraPunto"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/barrapunto.png" title="BarraPunto" alt="BarraPunto" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://meneame.net/submit.php?url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F06%2F09%2Fexec%2F" title="Meneame"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/meneame.gif" title="Meneame" alt="Meneame" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://slashdot.org/bookmark.pl?title=exec&amp;url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F06%2F09%2Fexec%2F" title="Slashdot"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F06%2F09%2Fexec%2F" title="Technorati"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F06%2F09%2Fexec%2F&amp;=exec" title="YahooMyWeb"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/yahoomyweb.png" title="YahooMyWeb" alt="YahooMyWeb" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></description>
		<wfw:commentRss>http://www.bisente.com/blog/2008/06/09/exec/feed/</wfw:commentRss>
		</item>
		<item>
		<title>tac</title>
		<link>http://www.bisente.com/blog/2008/04/22/tac/</link>
		<comments>http://www.bisente.com/blog/2008/04/22/tac/#comments</comments>
		<pubDate>Tue, 22 Apr 2008 18:12:35 +0000</pubDate>
		<dc:creator>bisente</dc:creator>
		
		<category><![CDATA[Command Line]]></category>

		<category><![CDATA[English]]></category>

		<category><![CDATA[Linuxadas]]></category>

		<category><![CDATA[al revés]]></category>

		<category><![CDATA[cat]]></category>

		<category><![CDATA[inverso]]></category>

		<category><![CDATA[reverse]]></category>

		<category><![CDATA[tac]]></category>

		<guid isPermaLink="false">http://www.bisente.com/blog/2008/04/22/new-title-in-spanish-8/</guid>
		<description><![CDATA[<!-- google_ad_section_start --><p>[spanish]¡cat al revés![/spanish]<br />
[english]A reverse cat![/english]</p>
<pre>
<div class="codesnip-container" ># cat file
1st line
2nd line
3rd line

# tac file
3rd line
2nd line
1st line</div>
</pre>
<p>[spanish]A veces es necesario procesar un fichero en orden inverso, p.ej. un log para tener las últimas entradas primero. Recuerdo haber tenido que programar algo así en C hace unos años porque no conocía éste comando&#8230;[/spanish]<br />
[english]Sometimes you need to process a file starting at the end, case in point a log file and you want to go from the last lines up. I remember programming something like this in C some years ago because I didn&#8217;t knew this command existed&#8230;[/english]<br />
<h3>Artículos relacionados (o no):</h3>
<ul class="related_post">
<li><a href="http://www.bisente.com/blog/2008/11/16/move-to-the-city/" title="Move to the city">Move to the city</a></li>
</ul>
<!-- google_ad_section_end -->
<div class="sociable">
<div class="sociable_tagline">
<strong>Enviar a:</strong>
</div>
<ul>
	<li><a rel="nofollow" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F04%2F22%2Ftac%2F&amp;title=tac" title="Digg"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://sphinn.com/submit.php?url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F04%2F22%2Ftac%2F&amp;title=tac" title="Sphinn"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F04%2F22%2Ftac%2F&amp;title=tac" title="del.icio.us"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F04%2F22%2Ftac%2F&amp;t=tac" title="Facebook"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F04%2F22%2Ftac%2F&amp;title=tac" title="Mixx"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F04%2F22%2Ftac%2F&amp;title=tac" title="Google"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://barrapunto.com/submit.pl?subj=tac&amp;story=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F04%2F22%2Ftac%2F" title="BarraPunto"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/barrapunto.png" title="BarraPunto" alt="BarraPunto" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://meneame.net/submit.php?url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F04%2F22%2Ftac%2F" title="Meneame"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/meneame.gif" title="Meneame" alt="Meneame" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://slashdot.org/bookmark.pl?title=tac&amp;url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F04%2F22%2Ftac%2F" title="Slashdot"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F04%2F22%2Ftac%2F" title="Technorati"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F04%2F22%2Ftac%2F&amp;=tac" title="YahooMyWeb"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/yahoomyweb.png" title="YahooMyWeb" alt="YahooMyWeb" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></description>
		<wfw:commentRss>http://www.bisente.com/blog/2008/04/22/tac/feed/</wfw:commentRss>
		</item>
		<item>
		<title>rsync &#8211;partial</title>
		<link>http://www.bisente.com/blog/2008/04/21/rsync-partial/</link>
		<comments>http://www.bisente.com/blog/2008/04/21/rsync-partial/#comments</comments>
		<pubDate>Mon, 21 Apr 2008 21:22:59 +0000</pubDate>
		<dc:creator>bisente</dc:creator>
		
		<category><![CDATA[Command Line]]></category>

		<category><![CDATA[English]]></category>

		<category><![CDATA[Linuxadas]]></category>

		<category><![CDATA[error conexión]]></category>

		<category><![CDATA[parcial]]></category>

		<category><![CDATA[rsync]]></category>

		<category><![CDATA[truncado]]></category>

		<guid isPermaLink="false">http://www.bisente.com/blog/2008/04/21/rsync-partial/</guid>
		<description><![CDATA[<!-- google_ad_section_start --><p>[spanish]<br />
Todo el mundo conoce el programa <a href="http://samba.anu.edu.au/rsync/" title="rsync" onclick="javascript:pageTracker._trackPageview ('/outbound/samba.anu.edu.au');">rsync</a>. Es muy útil para sincronizar el contenido de dos máquinas por red, minimizando el tráfico.</p>
<p>El problema es la primera vez que se ejecuta o se sincroniza un determinado archivo, ya que si la conexión es inestable y no se copia el archivo entero, rsync borra el trozo que haya llegado a copiar. Dicho de otra forma, cuando copia en lugar de sincronizar, sólo copia ficheros completos.</p>
<p>Por suerte hay un parámetro en línea de comandos para evitarlo, y que ante un corte en la conexión, deje el archivo parcial y lo continúe en la próxima ejecución:<br />
[/spanish]<br />
[english]Everybody knows the <a href="http://samba.anu.edu.au/rsync/" title="rsync" onclick="javascript:pageTracker._trackPageview ('/outbound/samba.anu.edu.au');">rsync</a> command. It&#8217;s very useful when you need to keep two machines in sync over the network, minimizing the bandwidth used.</p>
<p>The only problem lies when running it for the first time, or when a new file appears and it&#8217;s newly uploaded to the other end: if the network connection is unstable and goes down, rsync deletes the partially uploaded file and it needs to be uploaded again. In other words, when copying new files instead of syncing existing ones, rsync only copies full files.</p>
<p>Luckily there&#8217;s a command line parameter to avoid this behaviour and, in the event of a network failure, force rsync to leave the partially-uploaded file as-is and continue syncing it from there on the next run:[/english]</p>
<pre>
<div class="codesnip-container" ># rsync --help
...
    --partial               keep partially transferred files</div>
</pre>
<h3>Artículos relacionados (o no):</h3>
<ul class="related_post">
<li><a href="http://www.bisente.com/blog/2008/10/02/cluster-de-correo-escalable-con-software-libre/" title="[spanish]Cluster de correo escalable con software libre[/spanish][english]Open source, scalable MTA clusters[/english]">[spanish]Cluster de correo escalable con software libre[/spanish][english]Open source, scalable MTA clusters[/english]</a></li>
<li><a href="http://www.bisente.com/blog/2008/02/19/time-machine-y-maquinas-virtuales/" title="[spanish]Time Machine y máquinas virtuales[/spanish][english]Time Machine and Virtual Machines[/english]">[spanish]Time Machine y máquinas virtuales[/spanish][english]Time Machine and Virtual Machines[/english]</a></li>
</ul>
<!-- google_ad_section_end -->
<div class="sociable">
<div class="sociable_tagline">
<strong>Enviar a:</strong>
</div>
<ul>
	<li><a rel="nofollow" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F04%2F21%2Frsync-partial%2F&amp;title=rsync%20--partial" title="Digg"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://sphinn.com/submit.php?url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F04%2F21%2Frsync-partial%2F&amp;title=rsync%20--partial" title="Sphinn"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F04%2F21%2Frsync-partial%2F&amp;title=rsync%20--partial" title="del.icio.us"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F04%2F21%2Frsync-partial%2F&amp;t=rsync%20--partial" title="Facebook"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F04%2F21%2Frsync-partial%2F&amp;title=rsync%20--partial" title="Mixx"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F04%2F21%2Frsync-partial%2F&amp;title=rsync%20--partial" title="Google"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://barrapunto.com/submit.pl?subj=rsync%20--partial&amp;story=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F04%2F21%2Frsync-partial%2F" title="BarraPunto"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/barrapunto.png" title="BarraPunto" alt="BarraPunto" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://meneame.net/submit.php?url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F04%2F21%2Frsync-partial%2F" title="Meneame"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/meneame.gif" title="Meneame" alt="Meneame" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://slashdot.org/bookmark.pl?title=rsync%20--partial&amp;url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F04%2F21%2Frsync-partial%2F" title="Slashdot"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F04%2F21%2Frsync-partial%2F" title="Technorati"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F04%2F21%2Frsync-partial%2F&amp;=rsync%20--partial" title="YahooMyWeb"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/yahoomyweb.png" title="YahooMyWeb" alt="YahooMyWeb" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></description>
		<wfw:commentRss>http://www.bisente.com/blog/2008/04/21/rsync-partial/feed/</wfw:commentRss>
		</item>
		<item>
		<title>cut &#124; sort &#124; uniq: Apache logs</title>
		<link>http://www.bisente.com/blog/2008/03/26/cut-sort-uniq-apache-logs/</link>
		<comments>http://www.bisente.com/blog/2008/03/26/cut-sort-uniq-apache-logs/#comments</comments>
		<pubDate>Wed, 26 Mar 2008 20:24:16 +0000</pubDate>
		<dc:creator>bisente</dc:creator>
		
		<category><![CDATA[Command Line]]></category>

		<category><![CDATA[English]]></category>

		<category><![CDATA[Google]]></category>

		<category><![CDATA[Internet]]></category>

		<category><![CDATA[Linuxadas]]></category>

		<category><![CDATA[lighttpd]]></category>

		<category><![CDATA[access.log]]></category>

		<category><![CDATA[Apache]]></category>

		<category><![CDATA[bots]]></category>

		<category><![CDATA[DoS]]></category>

		<category><![CDATA[grep]]></category>

		<category><![CDATA[logs]]></category>

		<category><![CDATA[sort]]></category>

		<category><![CDATA[uniq]]></category>

		<guid isPermaLink="false">http://www.bisente.com/blog/2008/03/26/cut-sort-uniq-apache-logs/</guid>
		<description><![CDATA[<!-- google_ad_section_start --><p>[spanish]</p>
<p>Muchas veces cuando un servidor web va lento es posible que esté ante un &#8220;ataque&#8221;, intencionado o no, por parte de algún bot. He visto casos en los que el propio Google Bot o bots de universidades u otros indexadores generaban más de la mitad del tráfico de un sitio web. Estos casos no son un <a href="http://es.wikipedia.org/wiki/Ataque_de_denegaci%C3%B3n_de_servicio" title="DoS" onclick="javascript:pageTracker._trackPageview ('/outbound/es.wikipedia.org');">ataque DoS</a> como tal, sería tráfico legítimo, pero el resultado es que nos &#8220;tumban&#8221; el servicio. En algunos casos como con Google se puede configurar con las <a href="http://www.google.com/webmasters/tools/" title="Google Webmaster Tools" onclick="javascript:pageTracker._trackPageview ('/outbound/www.google.com');">Webmaster Tools</a> y los ficheros <a href="http://www.sitemaps.org/" title="sitemaps" onclick="javascript:pageTracker._trackPageview ('/outbound/www.sitemaps.org');">sitemaps</a> y/o <a href="http://www.robotstxt.org/" title="robots.txt" onclick="javascript:pageTracker._trackPageview ('/outbound/www.robotstxt.org');">robots.txt</a> la frecuencia de las visitas y a qué páginas acceder, en otros no y tendremos que valorar filtrar ese tráfico a nivel de firewall. Pero en cualquier caso el primer paso es detectar que realmente hay una IP (o un grupo de IPs) que nos está &#8220;machacando&#8221; y con <a href="http://es.wikipedia.org/wiki/Whois" title="whois" onclick="javascript:pageTracker._trackPageview ('/outbound/es.wikipedia.org');">whois</a> averiguar quién es.</p>
<p>Para ver las cinco IPs con más accesos en el Apache podemos ejecutar algo así:</p>
<p>[/spanish]<br />
[english]</p>
<p>Many times the reason because a web server is slow and unresponsive is that it&#8217;s under &#8220;attack&#8221;, on purpose or not, by a bot. I&#8217;ve seen cases where Google Bot, bots from research engines from universities or some other kind of indexer were responsible for more than half the traffic of a site. These cases are not real <a href="http://en.wikipedia.org/wiki/Denial-of-service_attack" title="DoS" onclick="javascript:pageTracker._trackPageview ('/outbound/en.wikipedia.org');">DoS attacks</a>, this traffic can be considered legitimate, but the result is that it brings the service down. You can instruct some of these bots not to visit your site so often, like Google Bot using the <a href="http://www.google.com/webmasters/tools/" title="Google Webmaster Tools" onclick="javascript:pageTracker._trackPageview ('/outbound/www.google.com');">Google Webmaster Tools</a> and the <a href="http://www.sitemaps.org/" title="sitemaps" onclick="javascript:pageTracker._trackPageview ('/outbound/www.sitemaps.org');">sitemaps</a> and/or <a href="http://www.robotstxt.org/" title="robots.txt" onclick="javascript:pageTracker._trackPageview ('/outbound/www.robotstxt.org');">robots.txt</a> files, but usually you can&#8217;t and have to consider filtering all this traffic at the firewall. But in any case, the first step is realizing that a single IP (or a couple of them) is responsible for most of your traffic, identifying this IP and using <a href="http://en.wikipedia.org/wiki/Whois" title="whois" onclick="javascript:pageTracker._trackPageview ('/outbound/en.wikipedia.org');">whois</a> learn who it belongs to.</p>
<p>You can run something like this to list the top five IP addresses on your Apache&#8217;s access.log:</p>
<p>[/english]</p>
<pre>
<div class="codesnip-container" >cut -d" " -f 1 access.log | sort | uniq -c | sort -nr | head -n 5</div>
</pre>
<h3>Artículos relacionados (o no):</h3>
<ul class="related_post">
<li><a href="http://www.bisente.com/blog/2008/10/17/tail-f-accesslog-%c2%a1grafico/" title="tail -f access.log &#8230; ¡gráfico!">tail -f access.log &#8230; ¡gráfico!</a></li>
<li><a href="http://www.bisente.com/blog/2008/02/10/pkill/" title="pkill">pkill</a></li>
<li><a href="http://www.bisente.com/blog/2008/01/14/varios-websites-con-https-sobre-una-misma-ip/" title="[spanish]Varios websites con HTTPS sobre una misma IP[/spanish][english]How to serve several domains with HTTPS and a single IP address[/english]">[spanish]Varios websites con HTTPS sobre una misma IP[/spanish][english]How to serve several domains with HTTPS and a single IP address[/english]</a></li>
</ul>
<!-- google_ad_section_end -->
<div class="sociable">
<div class="sociable_tagline">
<strong>Enviar a:</strong>
</div>
<ul>
	<li><a rel="nofollow" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F03%2F26%2Fcut-sort-uniq-apache-logs%2F&amp;title=cut%20%7C%20sort%20%7C%20uniq%3A%20Apache%20logs" title="Digg"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://sphinn.com/submit.php?url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F03%2F26%2Fcut-sort-uniq-apache-logs%2F&amp;title=cut%20%7C%20sort%20%7C%20uniq%3A%20Apache%20logs" title="Sphinn"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F03%2F26%2Fcut-sort-uniq-apache-logs%2F&amp;title=cut%20%7C%20sort%20%7C%20uniq%3A%20Apache%20logs" title="del.icio.us"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F03%2F26%2Fcut-sort-uniq-apache-logs%2F&amp;t=cut%20%7C%20sort%20%7C%20uniq%3A%20Apache%20logs" title="Facebook"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F03%2F26%2Fcut-sort-uniq-apache-logs%2F&amp;title=cut%20%7C%20sort%20%7C%20uniq%3A%20Apache%20logs" title="Mixx"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F03%2F26%2Fcut-sort-uniq-apache-logs%2F&amp;title=cut%20%7C%20sort%20%7C%20uniq%3A%20Apache%20logs" title="Google"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://barrapunto.com/submit.pl?subj=cut%20%7C%20sort%20%7C%20uniq%3A%20Apache%20logs&amp;story=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F03%2F26%2Fcut-sort-uniq-apache-logs%2F" title="BarraPunto"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/barrapunto.png" title="BarraPunto" alt="BarraPunto" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://meneame.net/submit.php?url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F03%2F26%2Fcut-sort-uniq-apache-logs%2F" title="Meneame"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/meneame.gif" title="Meneame" alt="Meneame" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://slashdot.org/bookmark.pl?title=cut%20%7C%20sort%20%7C%20uniq%3A%20Apache%20logs&amp;url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F03%2F26%2Fcut-sort-uniq-apache-logs%2F" title="Slashdot"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F03%2F26%2Fcut-sort-uniq-apache-logs%2F" title="Technorati"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F03%2F26%2Fcut-sort-uniq-apache-logs%2F&amp;=cut%20%7C%20sort%20%7C%20uniq%3A%20Apache%20logs" title="YahooMyWeb"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/yahoomyweb.png" title="YahooMyWeb" alt="YahooMyWeb" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></description>
		<wfw:commentRss>http://www.bisente.com/blog/2008/03/26/cut-sort-uniq-apache-logs/feed/</wfw:commentRss>
		</item>
		<item>
		<title>tar stdin/stdout</title>
		<link>http://www.bisente.com/blog/2008/03/12/tar-stdin-stdout/</link>
		<comments>http://www.bisente.com/blog/2008/03/12/tar-stdin-stdout/#comments</comments>
		<pubDate>Wed, 12 Mar 2008 19:42:43 +0000</pubDate>
		<dc:creator>bisente</dc:creator>
		
		<category><![CDATA[Command Line]]></category>

		<category><![CDATA[English]]></category>

		<category><![CDATA[Linuxadas]]></category>

		<category><![CDATA[copia]]></category>

		<category><![CDATA[directorios]]></category>

		<category><![CDATA[ficheros]]></category>

		<category><![CDATA[local]]></category>

		<category><![CDATA[permisos]]></category>

		<category><![CDATA[propietarios]]></category>

		<category><![CDATA[remoto]]></category>

		<category><![CDATA[ssh]]></category>

		<category><![CDATA[stdin]]></category>

		<category><![CDATA[stdout]]></category>

		<category><![CDATA[tar]]></category>

		<category><![CDATA[usuarios]]></category>

		<guid isPermaLink="false">http://www.bisente.com/blog/2008/03/12/tar-stdinstdout/</guid>
		<description><![CDATA[<!-- google_ad_section_start --><p>[spanish]El comando <em>tar</em>, como la mayoría de comandos UNIX, permite usar como entrada o salida se su operación la entrada/salida estandar del sistema, indicando &#8220;-&#8221; como origen/destino en lugar de un fichero.</p>
<p>¿Utilidades? P.ej. copiar estructuras de directorios completas manteniendo fecha, propietarios y permisos, en local o incluso en remoto con ayuda de ssh.</p>
<p>(luego me llaman friki por hacer éste tipo de cosas en el trabajo&#8230;)</p>
<p>[/spanish]<br />
[english]The tar command, like many other UNIX commands, can use stdin/stdout as its input/output target by using &#8220;-&#8221; instead of a real file.</p>
<p>What&#8217;s this useful for? For example, copying a full directory tree while keeping dates, ownerships and permissions, locally or remotely with ssh.</p>
<p>[/english]</p>
<pre>
<div class="codesnip-container" >$ tar cf - . | ( cd /some/other/dir ; tar xfv - )
$ tar cf - dir | ssh usr@srv "tar xfv -"</div>
</pre>
<h3>Artículos relacionados (o no):</h3>
<ul class="related_post">
<li><a href="http://www.bisente.com/blog/2008/02/13/cssh-cluster-ssh/" title="cssh: Cluster SSH">cssh: Cluster SSH</a></li>
</ul>
<!-- google_ad_section_end -->
<div class="sociable">
<div class="sociable_tagline">
<strong>Enviar a:</strong>
</div>
<ul>
	<li><a rel="nofollow" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F03%2F12%2Ftar-stdin-stdout%2F&amp;title=tar%20stdin%2Fstdout" title="Digg"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://sphinn.com/submit.php?url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F03%2F12%2Ftar-stdin-stdout%2F&amp;title=tar%20stdin%2Fstdout" title="Sphinn"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F03%2F12%2Ftar-stdin-stdout%2F&amp;title=tar%20stdin%2Fstdout" title="del.icio.us"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F03%2F12%2Ftar-stdin-stdout%2F&amp;t=tar%20stdin%2Fstdout" title="Facebook"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F03%2F12%2Ftar-stdin-stdout%2F&amp;title=tar%20stdin%2Fstdout" title="Mixx"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F03%2F12%2Ftar-stdin-stdout%2F&amp;title=tar%20stdin%2Fstdout" title="Google"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://barrapunto.com/submit.pl?subj=tar%20stdin%2Fstdout&amp;story=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F03%2F12%2Ftar-stdin-stdout%2F" title="BarraPunto"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/barrapunto.png" title="BarraPunto" alt="BarraPunto" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://meneame.net/submit.php?url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F03%2F12%2Ftar-stdin-stdout%2F" title="Meneame"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/meneame.gif" title="Meneame" alt="Meneame" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://slashdot.org/bookmark.pl?title=tar%20stdin%2Fstdout&amp;url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F03%2F12%2Ftar-stdin-stdout%2F" title="Slashdot"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F03%2F12%2Ftar-stdin-stdout%2F" title="Technorati"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F03%2F12%2Ftar-stdin-stdout%2F&amp;=tar%20stdin%2Fstdout" title="YahooMyWeb"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/yahoomyweb.png" title="YahooMyWeb" alt="YahooMyWeb" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></description>
		<wfw:commentRss>http://www.bisente.com/blog/2008/03/12/tar-stdin-stdout/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Shell-script: valores p.def. para variables</title>
		<link>http://www.bisente.com/blog/2008/03/06/shell-script-valores-pdef-para-variables/</link>
		<comments>http://www.bisente.com/blog/2008/03/06/shell-script-valores-pdef-para-variables/#comments</comments>
		<pubDate>Thu, 06 Mar 2008 05:38:58 +0000</pubDate>
		<dc:creator>bisente</dc:creator>
		
		<category><![CDATA[Command Line]]></category>

		<category><![CDATA[English]]></category>

		<category><![CDATA[Linuxadas]]></category>

		<category><![CDATA[default]]></category>

		<category><![CDATA[p.def.]]></category>

		<category><![CDATA[por defecto]]></category>

		<category><![CDATA[variable]]></category>

		<guid isPermaLink="false">http://www.bisente.com/blog/2008/03/06/shell-script-valores-pdef-para-variables/</guid>
		<description><![CDATA[<!-- google_ad_section_start --><p>[spanish]</p>
<p>Puedes darle un valor p.def. a una variable cuando no esté ya definida con:</p>
<pre>
<div class="codesnip-container" >FOO=${FOO:=bar}</div>
</pre>
<p>Ejemplo:<br />
[/spanish]<br />
[english]<br />
It&#8217;s possible to assign a default value to a variable in case it isn&#8217;t already defined. The syntax is:</p>
<pre>
<div class="codesnip-container" >FOO=${FOO:=bar}</div>
</pre>
<p>Example:<br />
[/english]</p>
<pre>
<div class="codesnip-container" >$ FOO=${FOO:=bar}
$ echo $FOO
bar

$ BAR=test
$ BAR=${BAR:=foo}
$ echo $BAR
test</div>
</pre>
<h3>Artículos relacionados (o no):</h3>
<ul class="related_post">
<li>Pues no hay. :-(</li>
</ul>
<!-- google_ad_section_end -->
<div class="sociable">
<div class="sociable_tagline">
<strong>Enviar a:</strong>
</div>
<ul>
	<li><a rel="nofollow" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F03%2F06%2Fshell-script-valores-pdef-para-variables%2F&amp;title=%5Bspanish%5DShell-script%3A%20valores%20p.def.%20para%20variables%5B%2Fspanish%5D%5Benglish%5DShell-script%3A%20variable%20default%20vaule%5B%2Fenglish%5D" title="Digg"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://sphinn.com/submit.php?url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F03%2F06%2Fshell-script-valores-pdef-para-variables%2F&amp;title=%5Bspanish%5DShell-script%3A%20valores%20p.def.%20para%20variables%5B%2Fspanish%5D%5Benglish%5DShell-script%3A%20variable%20default%20vaule%5B%2Fenglish%5D" title="Sphinn"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F03%2F06%2Fshell-script-valores-pdef-para-variables%2F&amp;title=%5Bspanish%5DShell-script%3A%20valores%20p.def.%20para%20variables%5B%2Fspanish%5D%5Benglish%5DShell-script%3A%20variable%20default%20vaule%5B%2Fenglish%5D" title="del.icio.us"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F03%2F06%2Fshell-script-valores-pdef-para-variables%2F&amp;t=%5Bspanish%5DShell-script%3A%20valores%20p.def.%20para%20variables%5B%2Fspanish%5D%5Benglish%5DShell-script%3A%20variable%20default%20vaule%5B%2Fenglish%5D" title="Facebook"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F03%2F06%2Fshell-script-valores-pdef-para-variables%2F&amp;title=%5Bspanish%5DShell-script%3A%20valores%20p.def.%20para%20variables%5B%2Fspanish%5D%5Benglish%5DShell-script%3A%20variable%20default%20vaule%5B%2Fenglish%5D" title="Mixx"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F03%2F06%2Fshell-script-valores-pdef-para-variables%2F&amp;title=%5Bspanish%5DShell-script%3A%20valores%20p.def.%20para%20variables%5B%2Fspanish%5D%5Benglish%5DShell-script%3A%20variable%20default%20vaule%5B%2Fenglish%5D" title="Google"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://barrapunto.com/submit.pl?subj=%5Bspanish%5DShell-script%3A%20valores%20p.def.%20para%20variables%5B%2Fspanish%5D%5Benglish%5DShell-script%3A%20variable%20default%20vaule%5B%2Fenglish%5D&amp;story=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F03%2F06%2Fshell-script-valores-pdef-para-variables%2F" title="BarraPunto"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/barrapunto.png" title="BarraPunto" alt="BarraPunto" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://meneame.net/submit.php?url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F03%2F06%2Fshell-script-valores-pdef-para-variables%2F" title="Meneame"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/meneame.gif" title="Meneame" alt="Meneame" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://slashdot.org/bookmark.pl?title=%5Bspanish%5DShell-script%3A%20valores%20p.def.%20para%20variables%5B%2Fspanish%5D%5Benglish%5DShell-script%3A%20variable%20default%20vaule%5B%2Fenglish%5D&amp;url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F03%2F06%2Fshell-script-valores-pdef-para-variables%2F" title="Slashdot"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F03%2F06%2Fshell-script-valores-pdef-para-variables%2F" title="Technorati"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F03%2F06%2Fshell-script-valores-pdef-para-variables%2F&amp;=%5Bspanish%5DShell-script%3A%20valores%20p.def.%20para%20variables%5B%2Fspanish%5D%5Benglish%5DShell-script%3A%20variable%20default%20vaule%5B%2Fenglish%5D" title="YahooMyWeb"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/yahoomyweb.png" title="YahooMyWeb" alt="YahooMyWeb" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></description>
		<wfw:commentRss>http://www.bisente.com/blog/2008/03/06/shell-script-valores-pdef-para-variables/feed/</wfw:commentRss>
		</item>
		<item>
		<title>watch</title>
		<link>http://www.bisente.com/blog/2008/02/24/watch/</link>
		<comments>http://www.bisente.com/blog/2008/02/24/watch/#comments</comments>
		<pubDate>Sun, 24 Feb 2008 13:37:42 +0000</pubDate>
		<dc:creator>bisente</dc:creator>
		
		<category><![CDATA[Command Line]]></category>

		<category><![CDATA[English]]></category>

		<category><![CDATA[Linuxadas]]></category>

		<category><![CDATA[monitorizar]]></category>

		<category><![CDATA[ps]]></category>

		<category><![CDATA[watch]]></category>

		<guid isPermaLink="false">http://www.bisente.com/blog/2008/02/24/watch/</guid>
		<description><![CDATA[<!-- google_ad_section_start --><p>[spanish]</p>
<p><a href="http://linux.die.net/man/1/watch" title="watch" onclick="javascript:pageTracker._trackPageview ('/outbound/linux.die.net');">watch</a> ejecuta un comando y mantiene su salida en pantalla, refrescándola cada X tiempo y, opcionalmente, marcando las diferencias entre ejecuciones. Es una forma de monitorizar cambios en algún comando sin tener que estar todo el rato haciendo &#8220;cursor arriba - enter&#8221;. :-)</p>
<p>[/spanish]</p>
<p>[english]</p>
<p><a href="http://linux.die.net/man/1/watch" title="watch" onclick="javascript:pageTracker._trackPageview ('/outbound/linux.die.net');">watch</a> runs a command and keeps its output on screen updating it ever X seconds and, optionally, highlighting the differences on the output between executions. It&#8217;s an easy way to monitor the output of some command without having to spend several minutes pressing &#8220;cursor up - enter&#8221;. :-)</p>
<p>[/english]</p>
<pre>
<div class="codesnip-container" >watch -n 1 "ps aux | grep apache"</div>
</pre>
<h3>Artículos relacionados (o no):</h3>
<ul class="related_post">
<li><a href="http://www.bisente.com/blog/2008/02/10/pkill/" title="pkill">pkill</a></li>
</ul>
<p class="buymebeer"><form action="https://www.paypal.com/cgi-bin/webscr" target="paypal" method="post"><input type="hidden" name="cmd" value="_xclick" /><input type="hidden" name="business" value="bisente@bisente.com" /><input type="hidden" name="return" value="" /><input type="hidden" name="item_name" value="¡Invítame a una birra! for watch" /><input type="hidden" name="amount" value="3" /><input type="image" src="http://www.bisente.com/wp-content/plugins/buy-me-beer/icon_beer.gif" align="left" alt="" title="" hspace="3" /></form><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&amp;business=bisente@bisente.com&amp;amount=3&amp;return=&amp;item_name=¡Invítame+a+una+birra!+for+watch" target="paypal">Si te ha interesado, ¿me invitas a una cerveza? / If you liked the post, would you buy me a beer?</a></p><!-- google_ad_section_end -->
<div class="sociable">
<div class="sociable_tagline">
<strong>Enviar a:</strong>
</div>
<ul>
	<li><a rel="nofollow" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F02%2F24%2Fwatch%2F&amp;title=watch" title="Digg"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://sphinn.com/submit.php?url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F02%2F24%2Fwatch%2F&amp;title=watch" title="Sphinn"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F02%2F24%2Fwatch%2F&amp;title=watch" title="del.icio.us"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F02%2F24%2Fwatch%2F&amp;t=watch" title="Facebook"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F02%2F24%2Fwatch%2F&amp;title=watch" title="Mixx"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F02%2F24%2Fwatch%2F&amp;title=watch" title="Google"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://barrapunto.com/submit.pl?subj=watch&amp;story=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F02%2F24%2Fwatch%2F" title="BarraPunto"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/barrapunto.png" title="BarraPunto" alt="BarraPunto" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://meneame.net/submit.php?url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F02%2F24%2Fwatch%2F" title="Meneame"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/meneame.gif" title="Meneame" alt="Meneame" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://slashdot.org/bookmark.pl?title=watch&amp;url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F02%2F24%2Fwatch%2F" title="Slashdot"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F02%2F24%2Fwatch%2F" title="Technorati"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F02%2F24%2Fwatch%2F&amp;=watch" title="YahooMyWeb"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/yahoomyweb.png" title="YahooMyWeb" alt="YahooMyWeb" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></description>
		<wfw:commentRss>http://www.bisente.com/blog/2008/02/24/watch/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Shell-script: substrings</title>
		<link>http://www.bisente.com/blog/2008/02/16/new-title-in-spanish-4/</link>
		<comments>http://www.bisente.com/blog/2008/02/16/new-title-in-spanish-4/#comments</comments>
		<pubDate>Sat, 16 Feb 2008 19:16:39 +0000</pubDate>
		<dc:creator>bisente</dc:creator>
		
		<category><![CDATA[Command Line]]></category>

		<category><![CDATA[English]]></category>

		<category><![CDATA[Linuxadas]]></category>

		<category><![CDATA[bash]]></category>

		<category><![CDATA[subcadenas]]></category>

		<category><![CDATA[substrings]]></category>

		<category><![CDATA[variables]]></category>

		<guid isPermaLink="false">http://www.bisente.com/blog/2008/02/16/new-title-in-spanish-4/</guid>
		<description><![CDATA[<!-- google_ad_section_start --><p>[spanish]Es posible extraer subcadenas de una variable con el formato:</p>
<pre>
<div class="codesnip-container" >${VARIABLE:INICIO:TAMAÑO}</div>
</pre>
<p>Ejemplo:</p>
<pre>
<div class="codesnip-container" >$ A=abcdefghi
$ echo ${A:3:2}
de</div>
</pre>
<p>[/spanish]<br />
[english]<br />
You can work with substrings in bash using the following syntax:</p>
<pre>
<div class="codesnip-container" >${VARIABLE:START:LENGTH}</div>
</pre>
<p>Like in:</p>
<pre>
<div class="codesnip-container" >$ A=abcdefghi
$ echo ${A:3:2}
de</div>
</pre>
<p>[/english]<br />
<h3>Artículos relacionados (o no):</h3>
<ul class="related_post">
<li><a href="http://www.bisente.com/blog/2008/06/09/exec/" title="exec">exec</a></li>
</ul>
<!-- google_ad_section_end -->
<div class="sociable">
<div class="sociable_tagline">
<strong>Enviar a:</strong>
</div>
<ul>
	<li><a rel="nofollow" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F02%2F16%2Fnew-title-in-spanish-4%2F&amp;title=Shell-script%3A%20substrings" title="Digg"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://sphinn.com/submit.php?url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F02%2F16%2Fnew-title-in-spanish-4%2F&amp;title=Shell-script%3A%20substrings" title="Sphinn"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F02%2F16%2Fnew-title-in-spanish-4%2F&amp;title=Shell-script%3A%20substrings" title="del.icio.us"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F02%2F16%2Fnew-title-in-spanish-4%2F&amp;t=Shell-script%3A%20substrings" title="Facebook"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F02%2F16%2Fnew-title-in-spanish-4%2F&amp;title=Shell-script%3A%20substrings" title="Mixx"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F02%2F16%2Fnew-title-in-spanish-4%2F&amp;title=Shell-script%3A%20substrings" title="Google"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://barrapunto.com/submit.pl?subj=Shell-script%3A%20substrings&amp;story=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F02%2F16%2Fnew-title-in-spanish-4%2F" title="BarraPunto"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/barrapunto.png" title="BarraPunto" alt="BarraPunto" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://meneame.net/submit.php?url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F02%2F16%2Fnew-title-in-spanish-4%2F" title="Meneame"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/meneame.gif" title="Meneame" alt="Meneame" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://slashdot.org/bookmark.pl?title=Shell-script%3A%20substrings&amp;url=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F02%2F16%2Fnew-title-in-spanish-4%2F" title="Slashdot"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F02%2F16%2Fnew-title-in-spanish-4%2F" title="Technorati"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.bisente.com%2Fblog%2F2008%2F02%2F16%2Fnew-title-in-spanish-4%2F&amp;=Shell-script%3A%20substrings" title="YahooMyWeb"><img src="http://www.bisente.com/wp-content/plugins/sociable/images/yahoomyweb.png" title="YahooMyWeb" alt="YahooMyWeb" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></description>
		<wfw:commentRss>http://www.bisente.com/blog/2008/02/16/new-title-in-spanish-4/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 1.098 seconds -->
<!-- Cached page served by WP-Cache -->
