<?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:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Void And Any &#187; bash</title>
	<atom:link href="http://voidandany.free.fr/index.php/tag/bash/feed/" rel="self" type="application/rss+xml" />
	<link>http://voidandany.free.fr</link>
	<description>mon bazar...</description>
	<lastBuildDate>Sat, 09 Dec 2017 09:24:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>Echaper un apostrophe dans une chaine délimitée par des apostrophes</title>
		<link>http://voidandany.free.fr/index.php/echaper-une-apostrophe-dans-une-chaine-delimitee-par-des-apostrophes/</link>
		<comments>http://voidandany.free.fr/index.php/echaper-une-apostrophe-dans-une-chaine-delimitee-par-des-apostrophes/#comments</comments>
		<pubDate>Thu, 15 Dec 2011 20:14:10 +0000</pubDate>
		<dc:creator>voidAndAny</dc:creator>
				<category><![CDATA[Brèves]]></category>
		<category><![CDATA[bash]]></category>

		<guid isPermaLink="false">http://voidandany.free.fr/?p=4374</guid>
		<description><![CDATA[Le problème, j&#8217;ai la commande suivante : &#160; awk -F&#34;:&#34; '{ print &#34;username: &#34; $1 &#34;\t\tuid:&#34; $3 }' /etc/passwd &#160; Que je veux définir dans un alias, comme ceci : &#160; alias userlist= 'commande' &#160; Le problème ma commande contient &#8230; <a href="http://voidandany.free.fr/index.php/echaper-une-apostrophe-dans-une-chaine-delimitee-par-des-apostrophes/">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Le problème, j&#8217;ai la commande suivante :</p>
<p>&nbsp;</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #660033;">-F</span><span style="color: #ff0000;">&quot;:&quot;</span> <span style="color: #ff0000;">'{ print &quot;username: &quot; $1 &quot;\t\tuid:&quot; $3 }'</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">passwd</span></pre></div></div>

<p>&nbsp;</p>
<p>Que je veux définir dans un alias, comme ceci :</p>
<p>&nbsp;</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">userlist</span>= <span style="color: #ff0000;">'commande'</span></pre></div></div>

<p>&nbsp;</p>
<p>Le problème ma commande contient aussi bien des apostrophes (single quote) que des guillemets (quote).</p>
<p>Vu que j&#8217;ai pris le partie de mettre cette commande entre apostrophe, il faut que j&#8217;échappe (escape ne anglais ça sonne mieux) les apostrophes de la commande.</p>
<p>J&#8217;ai tenté le slash \&#8217; et le doublement d&#8217;apostrophe &nbsp;&raquo; sans succès et j&#8217;ai trouvé la (une) solution ici, il faut utiliser &#8216;\&nbsp;&raquo;</p>
<p>Mon alias est donc :</p>
<p>&nbsp;</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">userlist</span>=<span style="color: #ff0000;">'awk -F&quot;:&quot; '</span><span style="color: #000000; font-weight: bold;">\'</span><span style="color: #ff0000;">'{ print &quot;username: &quot; $1 &quot;\t\tuid:&quot; $3 }'</span><span style="color: #000000; font-weight: bold;">\'</span><span style="color: #ff0000;">' /etc/passwd'</span></pre></div></div>

<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Pour info cet alias donne la liste des utilisateurs présent sur le système et leur uid :</p>
<p>&nbsp;</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">username: root          uid:0
username: daemon        uid:1
username: bin           uid:2
username: sys           uid:3
username: sync          uid:4
username: games         uid:5</pre></div></div>

<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://voidandany.free.fr/index.php/echaper-une-apostrophe-dans-une-chaine-delimitee-par-des-apostrophes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ignorer le message &#171;&#160;impossible de préserver l&#8217;appartenance pour xxx : Permission non accordée&#160;&#187;</title>
		<link>http://voidandany.free.fr/index.php/ignorer-le-message-impossible-de-preserver-lappartenance-pour-xxx-permission-non-accordee/</link>
		<comments>http://voidandany.free.fr/index.php/ignorer-le-message-impossible-de-preserver-lappartenance-pour-xxx-permission-non-accordee/#comments</comments>
		<pubDate>Wed, 25 May 2011 20:01:31 +0000</pubDate>
		<dc:creator>voidAndAny</dc:creator>
				<category><![CDATA[Brèves]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[bash]]></category>

		<guid isPermaLink="false">http://voidandany.free.fr/?p=4044</guid>
		<description><![CDATA[Si vous utilisez la commande mv pour déplacer un fichier d&#8217;un système de fichiers Linux vers un système de fichiers Windows (FAT par exemple) vous aurez un message du type : mv: impossible de préserver l'appartenance pour « nom_du_fichier »: &#8230; <a href="http://voidandany.free.fr/index.php/ignorer-le-message-impossible-de-preserver-lappartenance-pour-xxx-permission-non-accordee/">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Si vous utilisez la commande mv pour déplacer un fichier d&#8217;un système de fichiers Linux vers un système de fichiers Windows (FAT par exemple) vous aurez un message du type :</p>
<p>
<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">mv: impossible de préserver l'appartenance pour « nom_du_fichier »: Permission non accordée</pre></div></div>

</p>
<p>Je n&#8217;ai pas trouvé d&#8217;options dans le man de mv pour ignorer les permissions lors du déplacement et avoir ces erreurs dans les logs de mon script m&#8217;embêtait un peu, voici donc la solution trouvée :</p>
<p>
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mv</span> nom_du_fichier destination <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">1</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-v</span> <span style="color: #c20cb9; font-weight: bold;">pr</span>éserver</pre></div></div>

</p>
<p>Je re-dirige la sortie des erreurs vers la sortie standard (2&gt;&amp;1) et j&#8217;ignore les messages contenant le mot-clé &laquo;&nbsp;préserver&nbsp;&raquo;</p>
<p>Ce n&#8217;est pas l&#8217;idéal mais c&#8217;est la seule solution que j&#8217;ai trouvé pour l&#8217;instant (si quelqu&#8217;un connait mieux je suis preneur)</p>
]]></content:encoded>
			<wfw:commentRss>http://voidandany.free.fr/index.php/ignorer-le-message-impossible-de-preserver-lappartenance-pour-xxx-permission-non-accordee/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Télécharger un lien contenant un point d&#8217;exclamation avec wget</title>
		<link>http://voidandany.free.fr/index.php/telecharger-un-lien-contenant-un-point-dexclamation-avec-wget/</link>
		<comments>http://voidandany.free.fr/index.php/telecharger-un-lien-contenant-un-point-dexclamation-avec-wget/#comments</comments>
		<pubDate>Wed, 05 Jan 2011 20:35:09 +0000</pubDate>
		<dc:creator>voidAndAny</dc:creator>
				<category><![CDATA[Brèves]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[wget]]></category>

		<guid isPermaLink="false">http://voidandany.free.fr/?p=2717</guid>
		<description><![CDATA[Je réalise actuellement des tests de XBMC afin de voir si je pourrais me séparer de Freevo qui faut l&#8217;avouer a une interface plutôt rétro. Bref j&#8217;ai voulu tester le skin XMC Transparency! dont l&#8217;URL de téléchargement contient un point d&#8217;exclamation &#8230; <a href="http://voidandany.free.fr/index.php/telecharger-un-lien-contenant-un-point-dexclamation-avec-wget/">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Je réalise actuellement des tests de XBMC afin de voir si je pourrais me séparer de Freevo qui faut l&#8217;avouer a une interface plutôt rétro.</p>
<p>Bref j&#8217;ai voulu tester le skin XMC Transparency! dont l&#8217;<span style="font-weight: bold;">URL</span> de téléchargement contient un<span style="font-weight: bold;"> point d&#8217;exclamation </span>:</p>
<p><a href="http://ronie.intodarkness.nl/Transparency!-v2.11.rar">http://ronie.intodarkness.nl/Transparency!-v2.11.rar</a></p>
<p>Et si on utilise <span style="font-weight: bold;">wget </span>simplement avec cet URL on aura le droit au message d&#8217;<span style="font-weight: bold;">erreur </span>suivant :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">bash</span>: <span style="color: #000000; font-weight: bold;">!</span>-v2.11.rar: event not found</pre></div></div>

<p>Pour s&#8217;affranchir du message il suffira d&#8217;<span style="font-weight: bold;">ajouter des apostrophes</span> :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #ff0000;">'http://ronie.intodarkness.nl/Transparency!-v2.11.rar'</span></pre></div></div>

<p>Ou de<strong> mettre un slash</strong> devant le caractère problématique :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>ronie.intodarkness.nl<span style="color: #000000; font-weight: bold;">/</span>Transparency\<span style="color: #000000; font-weight: bold;">!</span>-v2.11.rar</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://voidandany.free.fr/index.php/telecharger-un-lien-contenant-un-point-dexclamation-avec-wget/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Astuce bash : la variable HISTCONTROL</title>
		<link>http://voidandany.free.fr/index.php/astuce-bash-la-variable-histcontrol/</link>
		<comments>http://voidandany.free.fr/index.php/astuce-bash-la-variable-histcontrol/#comments</comments>
		<pubDate>Thu, 07 Oct 2010 18:25:32 +0000</pubDate>
		<dc:creator>voidAndAny</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[bashrc]]></category>

		<guid isPermaLink="false">http://voidandany.free.fr/?p=2491</guid>
		<description><![CDATA[Sur la page man de bash on peut lire ceci concernant la variable HISTCONTROL : HISTCONTROL Une liste de valeurs, séparées par des  deux-points,  commandant la  façon  dont  les  commandes  sont  sauvegardées dans la file d’historique.  Si  la  liste  des  &#8230; <a href="http://voidandany.free.fr/index.php/astuce-bash-la-variable-histcontrol/">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-medium wp-image-2553" style="margin-left: 10px; margin-right: 10px;" title="shell_97002957_27f6bdfe17_z" src="http://voidandany.free.fr/wp-content/uploads/shell_97002957_27f6bdfe17_z-300x225.jpg" alt="" width="300" height="225" />Sur la <a href="http://manpages.ubuntu.com/manpages/lucid/fr/man1/bash.1.html">page man de bash</a> on peut lire ceci concernant la variable HISTCONTROL :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">HISTCONTROL
 Une liste de valeurs, séparées par des  deux-points,  commandant
 la  façon  dont  les  commandes  sont  sauvegardées dans la file
 d’historique.  Si  la  liste  des  valeurs  contient  la  valeur
 ignorespace,  les  lignes  commençant par une espace ne sont pas
 sauvegardées dans la file  d’historique.  La  valeur  ignoredups
 conduit  à ne pas sauvegarder une ligne correspondant exactement
 à la ligne de commande précédente. La présence de ignoreboth est
 un  condensé pour ignorespace et ignoredups. La valeur erasedups
 conduit à retirer de la  file  d’historique  toutes  les  lignes
 précédant la ligne courante et lui correspondant avant que cette
 ligne y soit sauvegardée. Toute valeur qui ne fait pas partie de
 la  liste  ci-dessus est ignorée. Si HISTCONTROL est inexistante
 ou si elle ne contient  pas  une  valeur  correcte,  toutes  les
 lignes   lues   par   l’analyseur   de   l’interpréteur   seront
 sauvegardées dans la  file  d’historique,  selon  la  valeur  de
 HISTIGNORE.  La  seconde  ligne  et les suivantes d’une commande
 multiligne  ne  sont  pas  testées   et   sont   ajoutées   dans
 l’historique indépendamment de la valeur de HISTCONTROL.</pre></div></div>

<p><br class="spacer_" /></p>
<p>Voici quelques test pour ce rendre compte du comportement de l&#8217;historique en fonction de la valeur de HISTCONTROL.</p>
<p><br class="spacer_" /></p>
<h3>HISTCONTROL = ignoredup</h3>
<p>En mode ignoredup on tape cd temp / cd .. / cd temp / cd ..</p>
<p>Contenu de l&#8217;historique :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">539  cd temp
540  cd ..
541  cd temp
542  cd ..</pre></div></div>

<p><br class="spacer_" /></p>
<p>Par contre si on tape on tape cd temp /cd downloads / cd .. / cd .. on aura :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">544  cd temp
545  cd downloads/
546  cd ..</pre></div></div>

<p>Les <span style="font-weight: bold;">commandes identiques consécutives sont regroupées</span></p>
<p><br class="spacer_" /></p>
<h3>HISTCONTROL = erasedup</h3>
<p>En mode erasedups on tape cd temp / cd .. / cd temp / cd ..</p>
<p>Contenu de l&#8217;historique :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">550  cd temp
551  cd ..</pre></div></div>

<p><br class="spacer_" /></p>
<p>Qu&#8217;une seule ligne cd temp et cd .. a été gardé (les dernières) toutes <span style="font-weight: bold;">les précédentes</span> préalablement présentes/tapés (539-541, 544, 546) <span style="font-weight: bold;">ont été supprimées</span>.</p>
<p><br class="spacer_" /></p>
<h3>HISTCONTROL = ignorespace</h3>
<p>En mode ignorespace on saisie cd temp et cd .. précédé d&#8217;un espace</p>
<p>Contenu de l&#8217;historique :<br class="spacer_" /></p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">552  cd temp</pre></div></div>

<p>La commande cd &#8230; (précédée d&#8217;un espace) n&#8217;apparait pas</p>
<p><br class="spacer_" /></p>
<h3>HISTCONTROL = ignoreboth</h3>
<p>ignoreboth est un condensé pour ignorespace et ignoredups</p>
<p><br class="spacer_" /></p>
<h3>Mon Choix</h3>
<p>HISTCONTROL=erasedups:ignorespace</p>
]]></content:encoded>
			<wfw:commentRss>http://voidandany.free.fr/index.php/astuce-bash-la-variable-histcontrol/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>La vérité sur l&#8217;option purge d&#8217;aptitude</title>
		<link>http://voidandany.free.fr/index.php/la-verite-sur-loption-purge-daptitude/</link>
		<comments>http://voidandany.free.fr/index.php/la-verite-sur-loption-purge-daptitude/#comments</comments>
		<pubDate>Fri, 01 Oct 2010 15:32:10 +0000</pubDate>
		<dc:creator>voidAndAny</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[aptitude]]></category>
		<category><![CDATA[bash]]></category>

		<guid isPermaLink="false">http://voidandany.free.fr/?p=2706</guid>
		<description><![CDATA[Par défaut lorsque je veux désinstaller quelque chose j&#8217;utilise aptitude avec l&#8217;option purge au lieu de l&#8217;option remove. Cette option est documenté ainsi dans les pages man : Purge &#60;paquet&#62; : supprime le paquet ainsi que tous ses fichiers de configuration. &#8230; <a href="http://voidandany.free.fr/index.php/la-verite-sur-loption-purge-daptitude/">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-medium wp-image-2784" style="margin-left: 10px; margin-right: 10px;" title="M Propre 2710952912_3db8a4b6d7" src="http://voidandany.free.fr/wp-content/uploads/M-Propre-2710952912_3db8a4b6d7-300x201.jpg" alt="" width="300" height="201" />Par défaut lorsque je veux <span style="font-weight: bold;">désinstaller </span>quelque chose j&#8217;utilise <span style="font-weight: bold;">aptitude </span>avec l&#8217;option <span style="font-weight: bold;">purge </span>au lieu de l&#8217;option remove.</p>
<p>Cette option est documenté ainsi dans les <a href="http://sylvain.cherrier.free.fr/documentations/aptitude.8.html">pages man</a> :</p>
<p style="padding-left: 30px;">Purge &lt;<em>paquet</em>&gt; : supprime le paquet ainsi que tous ses fichiers de configuration.</p>
<p><br class="spacer_" /></p>
<p>Mais ce n&#8217;est pas vrai, en réalité l&#8217;option <span style="font-weight: bold;">purge </span>supprime le paquet ainsi que tous<span style="font-weight: bold;"> les fichiers de configuration globaux</span>.</p>
<p>C&#8217;est à dire uniquement les fichiers de configuration situés normalement sous /etc</p>
<p><span style="font-weight: bold;">Les fichiers</span> de configuration que l&#8217;application crée <span style="font-weight: bold;">dans votre /home </span>utilisateur sont <span style="font-weight: bold;">laissés</span>, il en résulte un joyeux bazar si vous gardez toujours votre home sur une partition dédiée (donc jamais re-créé) et que vous essayez beaucoup de logiciels.</p>
<p><br class="spacer_" /></p>
<p><span style="font-style: italic;">La solution :</span> il n&#8217;en existe pas d&#8217;autre que de parcourir à la main tous les répertoires . et de les supprimer si l&#8217;application à été supprimée.</p>
<p><br class="spacer_" /></p>
<p>Une idée à d&#8217;ailleurs été créé sur Ubuntu Brainstorm pour essayer de trouver un mécanisme plus automatisé :</p>
<p><a href="http://brainstorm.ubuntu.com/idea/5199/">Idea #5199: On package removal _optionally_ remove config files in home directories</a></p>
<p><br class="spacer_" /></p>
<p>Deuxième déception concernant aptitude, <span style="font-weight: bold;">seul les fichiers</span> de configuration des <span style="font-weight: bold;">paquets explicitement</span> <span style="font-weight: bold;">installés </span>sont <span style="font-weight: bold;">purgés</span>, ceux des paquets installé par dépendance restent.</p>
<p>Quand vous utilisez aptitude avec l&#8217;option purge ce dernier liste les paquets désinstallés tout court avec le suffixe {u} et ceux désinstallé + purgé avec le suffixe {p}</p>
<p>Pour purger la configuration de tous les paquets il faut utiliser l&#8217;option &#8211;purge-unused.</p>
<p><br class="spacer_" /></p>
<p>Le moyen le plus simple de ne pas oublier cette option est de la mettre dans le fichier /etc/apt/apt.conf sous le format :</p>
<p><code>aptitude::Purge-Unused="true" ;<br />
</code></p>
<p><br class="spacer_" /></p>
<p>A noter qu&#8217;il existe <a href="http://algebraicthunk.net/~dburrows/projects/aptitude/doc/en/ch02s04s05.html">une foule d&#8217;options paramétrables</a> dans ce fichier de configuration.</p>
<p><br class="spacer_" /></p>
<p>Enfin il est tout à fait possible de <span style="font-weight: bold;">purger </span>la configuration des anciennes dépendances désinstallés sans l&#8217;option purge-unused, via :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">aptitude</span> purge <span style="color: #ff0000;">'~c'</span></pre></div></div>

<p><br class="spacer_" /></p>
<p><span style="font-weight: bold; font-style: italic; text-decoration: underline;">Sources : </span></p>
<p><a title="Aptitude : purger à fond" href="http://fcargoet.evolix.net/2009/02/aptitude-purger-a-fond/">Aptitude : purger à fond</a></p>
<p><a title="Aptitude : purger aussi les vieux paquets désinstallés sans purge" href="http://fcargoet.evolix.net/2009/03/aptitude-purger-aussi-les-vieux-paquets-desinstalles-sans-purge/">Aptitude : purger aussi les vieux paquets désinstallés sans purge</a></p>
<p>Image <strong>By <a href="http://www.flickr.com/photos/zach_manchester/">Zach_ManchesterUK</a></strong> sous CC BY-NC-ND</p>
]]></content:encoded>
			<wfw:commentRss>http://voidandany.free.fr/index.php/la-verite-sur-loption-purge-daptitude/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Copie en ligne de commande avec une barre de progression (comparatif solutions)</title>
		<link>http://voidandany.free.fr/index.php/copie-en-ligne-de-commande-avec-une-barre-de-progression-comparatif-solutions/</link>
		<comments>http://voidandany.free.fr/index.php/copie-en-ligne-de-commande-avec-une-barre-de-progression-comparatif-solutions/#comments</comments>
		<pubDate>Tue, 28 Sep 2010 08:33:09 +0000</pubDate>
		<dc:creator>voidAndAny</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[cp]]></category>

		<guid isPermaLink="false">http://voidandany.free.fr/?p=2636</guid>
		<description><![CDATA[Voila un sujet qui traine dans mes archives depuis un moment et que j&#8217;ai enfin pris le temps d&#8217;étudier. Lorsque l&#8217;on fait la copie de tout un répertoire en ligne de commande (via cp) contenant pas mal de fichier il &#8230; <a href="http://voidandany.free.fr/index.php/copie-en-ligne-de-commande-avec-une-barre-de-progression-comparatif-solutions/">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Voila un sujet qui traine dans mes archives depuis un moment et que j&#8217;ai enfin pris le temps d&#8217;étudier.</p>
<p>Lorsque l&#8217;on fait la copie de tout un répertoire en ligne de commande (via cp) contenant pas mal de fichier il est toujours intéressant de savoir où on en est rendu.</p>
<p>J&#8217;ai donc cherché comment <span style="font-weight: bold;">ajouter une barre de progression</span> lors d&#8217;une <span style="font-weight: bold;">copie </span>avec cp à l&#8217;image de la boite de dialogue de copie de fichier qui apparait sous Gnome/Nautilus.</p>
<p><br class="spacer_" /></p>
<p>Je recherche un outil :</p>
<ul>
<li>en ligne de commande</li>
<li>permettant de copier tout un répertoire récursivement</li>
<li>indiquant la progression totale de la copie (sous forme d&#8217;une barre)</li>
</ul>
<p>et de façon optionnelle indiquant :</p>
<ul>
<li>la progression par fichier</li>
<li>la vitesse de copie</li>
<li>le fichier copié en cours</li>
<li>le temps restant pour le fichier</li>
<li>le temps restant global</li>
</ul>
<p><br class="spacer_" /></p>
<p>Pour les divers outils trouvés je les ai <span style="font-weight: bold;">testé </span>en copiant un <span style="font-weight: bold;">répertoire de 3 949 éléments pour un total de 3,4 Go</span>.</p>
<p>Le répertoire contient un mixte de petits fichiers (répertoire d&#8217;installation d&#8217;Eclipse) et de gros (plusieurs ISO)</p>
<p>Pour chacun des outils j&#8217;ai fait une <span style="font-weight: bold;">mesure du temps écoulé</span> (avec la commande <a href="http://www.math-linux.com/spip.php?article11">time</a>) et voici pour commencer le temps avec la simple commande cp -aR</p>
<p><br class="spacer_" /></p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">real    1m55.563s
&nbsp;
user    0m0.224s     
sys     0m17.285s
CPU     0m17.509s (user + sys)</pre></div></div>

<p><br class="spacer_" /></p>
<p>Je vais maintenant lister les différentes possibilités trouvées.</p>
<p><br class="spacer_" /></p>
<h3>Fonction cp_p dans le .bashrc</h3>
<p>Le première solution trouvée sur <a title="Posted 2 years, 8 months ago" href="http://chris-lamb.co.uk/2008/01/24/can-you-get-cp-to-give-a-progress-bar-like-wget/">&laquo;&nbsp;Can you get cp to give a progress bar like wget?&nbsp;&raquo;</a> consiste à ajouter une fonction (nommée dans l&#8217;exemple cp_p) dans le .bashrc.</p>
<p>Cette fonction utilise l&#8217;outil <a href="http://fr.wikipedia.org/wiki/Strace">strace</a> pour monitorer l&#8217;exécution de cp.</p>
<p><br class="spacer_" /></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
cp_p<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #7a0874; font-weight: bold;">&#123;</span>
 <span style="color: #c20cb9; font-weight: bold;">strace</span> <span style="color: #660033;">-q</span> <span style="color: #660033;">-ewrite</span> <span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #660033;">--</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${1}</span>&quot;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${2}</span>&quot;</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">1</span> \
 <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{
 count += $NF
 if (count % 10 == 0) {
 percent = count / total_size * 100
 printf &quot;%3d%% [&quot;, percent
 for (i=0;i&lt;=percent;i++)
 printf &quot;=&quot;
 printf &quot;&gt;&quot;
 for (i=percent;i&lt;100;i++)
 printf &quot; &quot;
 printf &quot;]\r&quot;
 }
 }
 END { print &quot;&quot; }'</span> <span style="color: #007800;">total_size</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">stat</span> <span style="color: #660033;">-c</span> <span style="color: #ff0000;">'%s'</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${1}</span>&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #007800;">count</span>=<span style="color: #000000;">0</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div>

<p>Malheureusement ce script ne permet pas de copier un répertoire et même avec un fichier unique il ne fonctionne pas, la barre de progression s&#8217;affiche sur une ligne nouvelle à chaque mise à jour :</p>
<p><a href="http://voidandany.free.fr/wp-content/uploads/Sélection_004.png"><img class="aligncenter size-full wp-image-2695" title="cp_p" src="http://voidandany.free.fr/wp-content/uploads/Sélection_004-e1285339619679.png" alt="" width="642" height="303" /></a><br class="spacer_" /></p>
<p><br class="spacer_" /></p>
<p>En creusant un peu, je suis tombé sur cette article <a href="http://tuxce.selfip.org/informatique/ajouter-une-barre-de-progression-a-cp">Ajouter une barre de progression à ‘cp’</a> qui utilise le même mécanisme (<span style="font-weight: bold;">fonction bashrc</span> utilisant strace)<br class="spacer_" /></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">cp_p<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #7a0874; font-weight: bold;">&#123;</span>
 <span style="color: #7a0874; font-weight: bold;">local</span> <span style="color: #007800;">params</span>=<span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #ff0000;">&quot;$@&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span>
 <span style="color: #666666; font-style: italic;"># Le dernier champs est la destination</span>
 <span style="color: #7a0874; font-weight: bold;">unset</span> params<span style="color: #7a0874; font-weight: bold;">&#91;</span>$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #800000;">${#params[@]}</span> - <span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>
 <span style="color: #666666; font-style: italic;"># $COLUMNS correspond à la largeur de votre terminal</span>
 <span style="color: #666666; font-style: italic;"># et est mise à jour après chaque commande si l'option</span>
 <span style="color: #666666; font-style: italic;"># checkwinsize est définie ou à la réception du signal WINCH</span>
 <span style="color: #c20cb9; font-weight: bold;">kill</span> <span style="color: #660033;">-s</span> WINCH <span style="color: #007800;">$$</span>
 <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$COLUMNS</span> <span style="color: #660033;">-lt</span> <span style="color: #000000;">20</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #660033;">-a</span> <span style="color: #660033;">--</span> <span style="color: #ff0000;">&quot;$@&quot;</span>; <span style="color: #7a0874; font-weight: bold;">return</span> <span style="color: #007800;">$?</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
 <span style="color: #007800;">lim</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #007800;">$COLUMNS</span> - <span style="color: #000000;">10</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
 <span style="color: #666666; font-style: italic;"># Les &quot;--&quot; sont là pour signifier qu'il n'y a pas d'options</span>
 <span style="color: #666666; font-style: italic;"># sinon, il faut modifier le &quot;du&quot; etc...</span>
 <span style="color: #666666; font-style: italic;"># J'utilise le &quot;-a&quot; pour pouvoir copier par exemple des</span>
 <span style="color: #666666; font-style: italic;"># répertoires sans soucis.</span>
 <span style="color: #c20cb9; font-weight: bold;">strace</span> <span style="color: #660033;">-e</span> <span style="color: #c20cb9; font-weight: bold;">write</span> <span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #660033;">-a</span> <span style="color: #660033;">--</span> <span style="color: #ff0000;">&quot;$@&quot;</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">1</span> <span style="color: #000000; font-weight: bold;">|</span>
 <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{
 count += $NF    # rajoute la valeur du dernier champs
 # 10 représente la fréquence d affichage
 if (count % 10 == 0)
 {
 percent = count / total_size * 100
 printf &quot;%3d%% [&quot;, percent
 for (i=0;i&lt;=percent*'</span><span style="color: #007800;">$lim</span><span style="color: #ff0000;">'/100;i++)
 printf &quot;=&quot;
 if (percent&lt;100)
 printf &quot;&gt;&quot;
 for (j=i;j&lt; '</span><span style="color: #007800;">$lim</span><span style="color: #ff0000;">';j++)
 printf &quot; &quot;
 printf &quot;]\r&quot;
 }
 }
 END { printf &quot;100\n&quot; }'</span> \
 <span style="color: #007800;">total_size</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">du</span> <span style="color: #660033;">-bc</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${params[@]}</span>&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'END {print $1}'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> \
 <span style="color: #007800;">count</span>=<span style="color: #000000;">0</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div>

<p><br class="spacer_" /></p>
<p>Et les corrections apportés résolvent les problèmes sus-mentionnés (copie de répertoire, vrai barre de progression)</p>
<p><a href="http://voidandany.free.fr/wp-content/uploads/Sélection_0032.png"><img class="aligncenter size-full wp-image-2696" title="cp_p" src="http://voidandany.free.fr/wp-content/uploads/Sélection_0032.png" alt="" width="641" height="37" /></a></p>
<p><br class="spacer_" /></p>
<table style="width: 500px;" border="0" cellspacing="0" align="center">
<tbody>
<tr>
<td style="background-color: #4e7db1; color: #ffffff; text-align: center;"><strong>Critère</strong></td>
<td style="background-color: #4e7db1; color: #ffffff; text-align: center;"><strong>Résultat</strong></td>
</tr>
<tr style="border-bottom: #4e7db1 solid 1px;">
<td style="border-bottom: #4e7db1 solid 1px; padding-left: 5px;">Ligne de commande</td>
<td style="border-bottom: #4e7db1 solid 1px; text-align: center;"><img title="ok" src="../wp-content/uploads/ok.png" alt="" width="16" height="16" /> ok</td>
</tr>
<tr>
<td style="border-bottom: #4e7db1 solid 1px; padding-left: 5px;">Copie répertoire</td>
<td style="text-align: center; border-bottom: #4e7db1 solid 1px;"><img title="ok" src="../wp-content/uploads/ok.png" alt="" width="16" height="16" /> ok</td>
</tr>
<tr>
<td style="border-bottom: #4e7db1 solid 1px; padding-left: 5px;">Progression globale</td>
<td style="text-align: center; border-bottom: #4e7db1 solid 1px;"><img title="ok" src="../wp-content/uploads/ok.png" alt="" width="16" height="16" /> ok</td>
</tr>
<tr>
<td style="border-bottom: #4e7db1 solid 2px; padding-left: 5px;">Ne nécessite pas une installation particulière</td>
<td style="text-align: center; border-bottom: #4e7db1 solid 2px;"><img title="ok" src="../wp-content/uploads/ok.png" alt="" width="16" height="16" /> ok</td>
</tr>
<tr>
<td style="border-bottom: #4e7db1 solid 1px; padding-left: 5px;">Progression par fichier</td>
<td style="text-align: center; border-bottom: #4e7db1 solid 1px;"><img title="ko" src="../wp-content/uploads/ko.png" alt="" width="16" height="16" /> ko</td>
</tr>
<tr>
<td style="border-bottom: #4e7db1 solid 1px; padding-left: 5px;">Vitesse de copie</td>
<td style="text-align: center; border-bottom: #4e7db1 solid 1px;"><img title="ko" src="../wp-content/uploads/ko.png" alt="" width="16" height="16" /> ko</td>
</tr>
<tr>
<td style="border-bottom: #4e7db1 solid 1px; padding-left: 5px;">Fichier en cours de copie</td>
<td style="text-align: center; border-bottom: #4e7db1 solid 1px;"><img title="ko" src="../wp-content/uploads/ko.png" alt="" width="16" height="16" /> ko</td>
</tr>
<tr>
</tr>
<tr>
<td style="border-bottom: #4e7db1 solid 1px; padding-left: 5px;">Temps restant fichier</td>
<td style="text-align: center; border-bottom: #4e7db1 solid 1px;"><img title="ko" src="../wp-content/uploads/ko.png" alt="" width="16" height="16" /> ko</td>
</tr>
<tr>
<td style="border-bottom: #4e7db1 solid 2px; padding-left: 5px;">Temps restant global</td>
<td style="text-align: center; border-bottom: #4e7db1 solid 2px;"><img title="ko" src="../wp-content/uploads/ko.png" alt="" width="16" height="16" /> ko</td>
</tr>
<tr>
<td style="border-bottom: #4e7db1 solid 1px; padding-left: 5px;">Temps de copie (réel / CPU)</td>
<td style="text-align: center; border-bottom: #4e7db1 solid 1px;">2min 03s / 48s</td>
</tr>
</tbody>
</table>
<p><br class="spacer_" /></p>
<p>Tous les critères de base sont remplis, la copie est un peu plus lente (+7%) et sollicite plus le processeur.</p>
<p>Enfin est à noter que parmi les nombreux essai réalisé de temps en temps la barre de progression n&#8217;arrivait pas au bout même lorsque que la copie était finie :</p>
<p><a href="http://voidandany.free.fr/wp-content/uploads/Sélection_009.png"><img class="aligncenter size-large wp-image-2697" title="cp_p" src="http://voidandany.free.fr/wp-content/uploads/Sélection_009-650x27.png" alt="" width="650" height="27" /></a><br class="spacer_" /></p>
<p><br class="spacer_" /></p>
<h3>Script Bash</h3>
<p>Deuxième solution trouvée ici : <a href="http://superuser.com/questions/155461/copy-file-in-gnu-linux-with-progress-bar-and-rate-limiting">Copy file in GNU/Linux with progress bar and rate limiting</a>, il s&#8217;agit d&#8217;un <span style="font-weight: bold;">script bash</span> : <br class="spacer_" /></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash </span>
&nbsp;
<span style="color: #000000; font-weight: bold;">set</span> <span style="color: #660033;">-e</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$#</span> <span style="color: #660033;">-lt</span> <span style="color: #000000;">2</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
 <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;cppv - copy files with progress bar and rate limiting ability&quot;</span>
 <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Usage: cppv source_file[s] destination_file_or_directory&quot;</span>
 <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;No other non-positional command line arguments can be given&quot;</span>
 <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Always recurses like find&quot;</span>
 <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;You can change copying speed limit on the fly with <span style="color: #000099; font-weight: bold;">\&quot;</span>pv -R<span style="color: #000099; font-weight: bold;">\&quot;</span> if you find out pv's PID&quot;</span>
 <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Use FIND_OPTS, PV_OPTS, CPIO_O_OPTS, CPIO_I_OPTS to override arguments to the pipeline parts&quot;</span>
 <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Examples:&quot;</span>
 <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;    cppv a b # Copy file a to b. Just calls <span style="color: #000099; font-weight: bold;">\&quot;</span>pv a &gt; b<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span>
 <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;    cppv a d/ # Copy file a to d/a. Calls <span style="color: #000099; font-weight: bold;">\&quot;</span>find a | cpio -o | pv | (cd d &amp;&amp; cpio -i)<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span>
 <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;    cppv *{01..26}*.mkv /mnt/usb/ # Copy all matching files to /mnt/usb/.&quot;</span>
 <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;    cppv dir1 dir2 # duplicate dir1&quot;</span>
 <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;    PV_OPTS=<span style="color: #000099; font-weight: bold;">\&quot;</span>-L 1M<span style="color: #000099; font-weight: bold;">\&quot;</span> cppv . /tmp/ # Limit copying rate to 1M&quot;</span>
 <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;    cppv /home/vi/bin /tmp/ # Warning: Copy /home/vi/bin to /tmp/home/vi/bin&quot;</span>
 <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">fi</span>;
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">true</span> <span style="color: #800000;">${CPIO_O_OPTS:=&quot;-H newc -0o&quot;}</span>
<span style="color: #c20cb9; font-weight: bold;">true</span> <span style="color: #800000;">${CPIO_I_OPTS:=&quot;-0diu --no-absolute-filenames&quot;}</span>
<span style="color: #c20cb9; font-weight: bold;">true</span> <span style="color: #800000;">${FIND_OPTS:=&quot;-depth -print0&quot;}</span>
&nbsp;
<span style="color: #007800;">ARGS</span>=<span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #ff0000;">&quot;$@&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span>;
&nbsp;
<span style="color: #007800;">DEST</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${ARGS[$#-1]}</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">unset</span> ARGS<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #007800;">$#</span>-<span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${1:0:1}</span>&quot;</span> == <span style="color: #ff0000;">&quot;-&quot;</span>  <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${DEST:0:1}</span>&quot;</span> == <span style="color: #ff0000;">&quot;-&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$DEST</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span>  <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
 <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;There should not be any command line options. Only file names.&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">2</span>
 <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>;
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #007800;">DIRMODE</span>=<span style="color: #000000;">0</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$#</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000;">2</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${DEST:${#DEST}</span>-1:1}&quot;</span> == <span style="color: #ff0000;">&quot;/&quot;</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #660033;">-d</span> <span style="color: #007800;">$DEST</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
 <span style="color: #007800;">DIRMODE</span>=<span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">elif</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-d</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-d</span> <span style="color: #ff0000;">&quot;$2&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
 <span style="color: #007800;">DIRMODE</span>=<span style="color: #000000;">1</span>
 <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$DEST</span>&quot;</span>;
 <span style="color: #007800;">DEST</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">readlink</span> <span style="color: #660033;">-f</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$DEST</span>&quot;</span><span style="color: #000000; font-weight: bold;">`</span>;
 <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #ff0000;">&quot;$1&quot;</span>;
 <span style="color: #007800;">ARGS</span>=<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #ff0000;">&quot;.&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$DIRMODE</span> == <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
 pv <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #ff0000;">&quot;$2&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span>;
<span style="color: #000000; font-weight: bold;">fi</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-d</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$DEST</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
 <span style="color: #7a0874; font-weight: bold;">echo</span> Not a directory: <span style="color: #ff0000;">&quot;<span style="color: #007800;">$DEST</span>&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">2</span>
 <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${1:0:1}</span>&quot;</span> == <span style="color: #ff0000;">&quot;/&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
 <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Warning: it will do a bit different thing than usual cp&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">2</span>
 <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;    For example, copying $1 to <span style="color: #007800;">$DEST</span>$1, not to <span style="color: #007800;">$DEST</span>/<span style="color: #780078;">`basename $1`</span>&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">2</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #007800;">SIZE</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">du</span> <span style="color: #660033;">-sb</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${ARGS[@]}</span>&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">perl</span> <span style="color: #660033;">-ne</span> <span style="color: #ff0000;">'/^(\d+)/ and $q+=$1; END{print $q}'</span><span style="color: #000000; font-weight: bold;">`</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${ARGS[@]}</span>&quot;</span> <span style="color: #007800;">$FIND_OPTS</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cpio</span> <span style="color: #007800;">$CPIO_O_OPTS</span> <span style="color: #000000; font-weight: bold;">|</span> pv <span style="color: #660033;">-s</span> <span style="color: #007800;">$SIZE</span> <span style="color: #007800;">$PV_OPTS</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$DEST</span>&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">cpio</span> <span style="color: #007800;">$CPIO_I_OPTS</span><span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

<p><br class="spacer_" /></p>
<p>Ce script utilise les commandes <a href="http://www.delafond.org/traducmanfr/man/man1/cpio.1.html">cpio</a> et <a href="http://blog.bmaron.net/index.php?post/2009/02/10/A-la-d%C3%A9couverte-de-5-Commandes-Linux-Sympa">pv</a>. Cette dernière n&#8217;est pas installé par défaut sous Ubuntu il faudra donc le faire :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> pv</pre></div></div>

<p><a href="../wp-content/uploads/S%C3%A9lection_005.png"><br />
 </a></p>
<p style="text-align: center;"><a href="../wp-content/uploads/S%C3%A9lection_005.png"><img class="aligncenter" title="cpp" src="../wp-content/uploads/S%C3%A9lection_005.png" alt="" width="641" height="33" /></a></p>
<p><br class="spacer_" /></p>
<table style="width: 500px;" border="0" cellspacing="0" align="center">
<tbody>
<tr>
<td style="background-color: #4e7db1; color: #ffffff; text-align: center;"><strong>Critère</strong></td>
<td style="background-color: #4e7db1; color: #ffffff; text-align: center;"><strong>Résultat</strong></td>
</tr>
<tr style="border-bottom: #4e7db1 solid 1px;">
<td style="border-bottom: #4e7db1 solid 1px; padding-left: 5px;">Ligne de commande</td>
<td style="border-bottom: #4e7db1 solid 1px; text-align: center;"><img title="ok" src="../wp-content/uploads/ok.png" alt="" width="16" height="16" /> ok</td>
</tr>
<tr>
<td style="border-bottom: #4e7db1 solid 1px; padding-left: 5px;">Copie répertoire</td>
<td style="text-align: center; border-bottom: #4e7db1 solid 1px;"><img title="ok" src="../wp-content/uploads/ok.png" alt="" width="16" height="16" /> ok</td>
</tr>
<tr>
<td style="border-bottom: #4e7db1 solid 1px; padding-left: 5px;">Progression globale</td>
<td style="text-align: center; border-bottom: #4e7db1 solid 1px;"><img title="ok" src="../wp-content/uploads/ok.png" alt="" width="16" height="16" /> ok</td>
</tr>
<tr>
<td style="border-bottom: #4e7db1 solid 2px; padding-left: 5px;">Ne nécessite pas une installation particulière</td>
<td style="text-align: center; border-bottom: #4e7db1 solid 2px;"><img title="ko" src="../wp-content/uploads/ko.png" alt="" width="16" height="16" /> ko</td>
</tr>
<tr>
<td style="border-bottom: #4e7db1 solid 1px; padding-left: 5px;">Progression par fichier</td>
<td style="text-align: center; border-bottom: #4e7db1 solid 1px;"><img title="ko" src="../wp-content/uploads/ko.png" alt="" width="16" height="16" /> ko</td>
</tr>
<tr>
<td style="border-bottom: #4e7db1 solid 1px; padding-left: 5px;">Vitesse de copie</td>
<td style="text-align: center; border-bottom: #4e7db1 solid 1px;"><img title="ok" src="../wp-content/uploads/ok.png" alt="" width="16" height="16" /> ok</td>
</tr>
<tr>
<td style="border-bottom: #4e7db1 solid 1px; padding-left: 5px;">Fichier en cours de copie</td>
<td style="text-align: center; border-bottom: #4e7db1 solid 1px;"><img title="ko" src="../wp-content/uploads/ko.png" alt="" width="16" height="16" /> ko</td>
</tr>
<tr>
</tr>
<tr>
<td style="border-bottom: #4e7db1 solid 1px; padding-left: 5px;">Temps restant fichier</td>
<td style="text-align: center; border-bottom: #4e7db1 solid 1px;"><img title="ok" src="../wp-content/uploads/ok.png" alt="" width="16" height="16" /> ok</td>
</tr>
<tr>
<td style="border-bottom: #4e7db1 solid 2px; padding-left: 5px;">Temps restant global</td>
<td style="text-align: center; border-bottom: #4e7db1 solid 2px;"><img title="ok" src="../wp-content/uploads/ok.png" alt="" width="16" height="16" /> ok</td>
</tr>
<tr>
<td style="border-bottom: #4e7db1 solid 1px; padding-left: 5px;">Temps de copie (réel / CPU)</td>
<td style="text-align: center; border-bottom: #4e7db1 solid 1px;">2min 24s / 1min 28s</td>
</tr>
</tbody>
</table>
<p><br class="spacer_" /></p>
<p>Dans cet outils j&#8217;apprécie particulièrement la <span style="font-weight: bold;">présentation des données</span> relativement <span style="font-weight: bold;">complètes et compactes,</span> cependant le <span style="font-weight: bold;">temps de copie</span> est tout de même considérablement <span style="font-weight: bold;">allongé </span>(+25%) ainsi que la charge CPU.</p>
<p>Autre point encore plus gênant le <span style="font-weight: bold;">comportement de la copie est différent</span> du cp classique, ainsi la ligne de commande :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>cpp.sh Téléchargements<span style="color: #000000; font-weight: bold;">/*</span> Temp<span style="color: #000000; font-weight: bold;">/</span>essaiCPP<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

<p><br class="spacer_" /></p>
<p>Ne copie pas le contenu de Téléchargement dans essaiCPP mais copie le répertoire Téléchargement, et si on avait voulu copier un sous dossier de Téléchargement, cela aurait reproduit l&#8217;arborescence, exemple :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>cpp.sh Téléchargements<span style="color: #000000; font-weight: bold;">/</span>Images_ISO<span style="color: #000000; font-weight: bold;">/</span>Ubuntu<span style="color: #000000; font-weight: bold;">/*</span> Temp<span style="color: #000000; font-weight: bold;">/</span>essaiCPP<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

<p>La copie créerait un répertoire Temp/essaiCPP/Téléchargements/Images_ISO/Ubuntu/</p>
<p><br class="spacer_" /></p>
<h3>Utilitaire vcp (iinet)</h3>
<p>Il s&#8217;agit d&#8217;un binaire visant à remplacer cp (et non plus un script).</p>
<p>Il n&#8217;existe pas de version packagé pour Ubuntu il faut donc le <span style="font-weight: bold;">compiler </span>depuis les sources que l&#8217;on récupérera ici :</p>
<p><a href="http://members.iinet.net.au/~lynx/vcp/">http://members.iinet.net.au/~lynx/vcp/</a></p>
<p><br class="spacer_" /></p>
<p>Installation des dépendances :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> libncurses5-dev libncursesw5-dev</pre></div></div>

<p><br class="spacer_" /></p>
<p>Téléchargement des sources et décompression :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>members.iinet.net.au<span style="color: #000000; font-weight: bold;">/</span>~lynx<span style="color: #000000; font-weight: bold;">/</span>vcp<span style="color: #000000; font-weight: bold;">/</span>vcp-<span style="color: #000000;">2.2</span>.tar.gz
<span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-xvf</span> vcp-<span style="color: #000000;">2.2</span>.tar.gz
<span style="color: #7a0874; font-weight: bold;">cd</span> vcp-<span style="color: #000000;">2.2</span></pre></div></div>

<p>Compilation / Installation :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">make</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">make</span> installconf</pre></div></div>

<p><br class="spacer_" /></p>
<p>On trouvera la <span style="font-weight: bold;">page man</span> de cet utilitaire <a href="http://linux.die.net/man/1/vcp">ici</a>, j&#8217;ai utilisé les options R (récursif) et v (verbose) afin d&#8217;obtenir le résultat suivant :</p>
<p><a href="http://voidandany.free.fr/wp-content/uploads/Sélection_006.png"><img class="aligncenter size-large wp-image-2736" title="vcp" src="http://voidandany.free.fr/wp-content/uploads/Sélection_006-650x351.png" alt="" width="650" height="351" /></a></p>
<p>A noter qu&#8217;il est possible de prendre ces <span style="font-weight: bold;">options par défaut </span>en les paramétrant dans le f<span style="font-weight: bold;">ichier de configuration</span> /etc/vcp.conf</p>
<p><br class="spacer_" /></p>
<table style="width: 500px;" border="0" cellspacing="0" align="center">
<tbody>
<tr>
<td style="background-color: #4e7db1; color: #ffffff; text-align: center;"><strong>Critère</strong></td>
<td style="background-color: #4e7db1; color: #ffffff; text-align: center;"><strong>Résultat</strong></td>
</tr>
<tr style="border-bottom: #4e7db1 solid 1px;">
<td style="border-bottom: #4e7db1 solid 1px; padding-left: 5px;">Ligne de commande</td>
<td style="border-bottom: #4e7db1 solid 1px; text-align: center;"><img title="ok" src="../wp-content/uploads/ok.png" alt="" width="16" height="16" /> ok</td>
</tr>
<tr>
<td style="border-bottom: #4e7db1 solid 1px; padding-left: 5px;">Copie répertoire</td>
<td style="text-align: center; border-bottom: #4e7db1 solid 1px;"><img title="ok" src="../wp-content/uploads/ok.png" alt="" width="16" height="16" /> ok</td>
</tr>
<tr>
<td style="border-bottom: #4e7db1 solid 1px; padding-left: 5px;">Progression globale</td>
<td style="text-align: center; border-bottom: #4e7db1 solid 1px;"><img title="ok" src="../wp-content/uploads/ok.png" alt="" width="16" height="16" /> ok</td>
</tr>
<tr>
<td style="border-bottom: #4e7db1 solid 2px; padding-left: 5px;">Ne nécessite pas une installation particulière</td>
<td style="text-align: center; border-bottom: #4e7db1 solid 2px;"><img title="ko" src="../wp-content/uploads/ko.png" alt="" width="16" height="16" /> ko</td>
</tr>
<tr>
<td style="border-bottom: #4e7db1 solid 1px; padding-left: 5px;">Progression par fichier</td>
<td style="text-align: center; border-bottom: #4e7db1 solid 1px;"><img title="ok" src="../wp-content/uploads/ok.png" alt="" width="16" height="16" /> ok</td>
</tr>
<tr>
<td style="border-bottom: #4e7db1 solid 1px; padding-left: 5px;">Vitesse de copie</td>
<td style="text-align: center; border-bottom: #4e7db1 solid 1px;"><img title="ok" src="../wp-content/uploads/ok.png" alt="" width="16" height="16" /> ok</td>
</tr>
<tr>
<td style="border-bottom: #4e7db1 solid 1px; padding-left: 5px;">Fichier en cours de copie</td>
<td style="text-align: center; border-bottom: #4e7db1 solid 1px;"><img title="ok" src="../wp-content/uploads/ok.png" alt="" width="16" height="16" /> ok</td>
</tr>
<tr>
</tr>
<tr>
<td style="border-bottom: #4e7db1 solid 1px; padding-left: 5px;">Temps restant fichier</td>
<td style="text-align: center; border-bottom: #4e7db1 solid 1px;"><img title="ok" src="../wp-content/uploads/ok.png" alt="" width="16" height="16" /> ok</td>
</tr>
<tr>
<td style="border-bottom: #4e7db1 solid 2px; padding-left: 5px;">Temps restant global</td>
<td style="text-align: center; border-bottom: #4e7db1 solid 2px;"><img title="ko" src="../wp-content/uploads/ko.png" alt="" width="16" height="16" /> ko</td>
</tr>
<tr>
<td style="border-bottom: #4e7db1 solid 1px; padding-left: 5px;">Temps de copie (réel / CPU)</td>
<td style="text-align: center; border-bottom: #4e7db1 solid 1px;">1min 56s / 23s</td>
</tr>
</tbody>
</table>
<p>On constate que cet utilitaire fourni quasiment<span style="font-weight: bold;"> tous les indicateurs </span>mentionnées et est <span style="font-weight: bold;">extrêmement performant </span>(pas de différences notables avec le cp de base).</p>
<p>Seul point noir, ce logiciel ne semble plus maintenu, la dernière version datant de 2007.</p>
<p><br class="spacer_" /></p>
<h3>Utilitaire vcp (lynix)</h3>
<p>En recherchant des informations sur l&#8217;outil précédent je suis tombé sur celui-ci ayant le même nom (vcp), dont le développement semble avoir commencé en 2009-2010.</p>
<p>Tout comme le précédent il faut le compiler.</p>
<p><br class="spacer_" /></p>
<p>Téléchargement des sources et décompression :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>lynix<span style="color: #000000; font-weight: bold;">/</span>vcp<span style="color: #000000; font-weight: bold;">/</span>tarball<span style="color: #000000; font-weight: bold;">/</span>master
<span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-xvf</span> lynix<span style="color: #000000; font-weight: bold;">*</span>.tar.gz
<span style="color: #7a0874; font-weight: bold;">cd</span> lynix<span style="color: #000000; font-weight: bold;">*</span></pre></div></div>

<p><br class="spacer_" /></p>
<p>Compilation / Installation :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">make</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

<p><br class="spacer_" /></p>
<p><span style="font-weight: bold;">Rque </span>: si vous installez ce logiciel après le précédent, il le remplacera, en effet ces deux outils ont le même nom et copie le binaire dans le même répertoire (solution modifier le Makefile, cf en fin d&#8217;article)</p>
<p><a href="http://voidandany.free.fr/wp-content/uploads/Sélection_0131.png"><img class="aligncenter size-large wp-image-2738" title="vcp" src="http://voidandany.free.fr/wp-content/uploads/Sélection_0131-650x281.png" alt="" width="650" height="281" /></a></p>
<p>Ou en moins verbeux :</p>
<p><a href="http://voidandany.free.fr/wp-content/uploads/Sélection_0121.png"><img class="aligncenter size-large wp-image-2737" title="vcp" src="http://voidandany.free.fr/wp-content/uploads/Sélection_0121-650x115.png" alt="" width="650" height="115" /></a></p>
<p><br class="spacer_" /></p>
<table style="width: 500px;" border="0" cellspacing="0" align="center">
<tbody>
<tr>
<td style="background-color: #4e7db1; color: #ffffff; text-align: center;"><strong>Critère</strong></td>
<td style="background-color: #4e7db1; color: #ffffff; text-align: center;"><strong>Résultat</strong></td>
</tr>
<tr style="border-bottom: #4e7db1 solid 1px;">
<td style="border-bottom: #4e7db1 solid 1px; padding-left: 5px;">Ligne de commande</td>
<td style="border-bottom: #4e7db1 solid 1px; text-align: center;"><img title="ok" src="../wp-content/uploads/ok.png" alt="" width="16" height="16" /> ok</td>
</tr>
<tr>
<td style="border-bottom: #4e7db1 solid 1px; padding-left: 5px;">Copie répertoire</td>
<td style="text-align: center; border-bottom: #4e7db1 solid 1px;"><img title="ok" src="../wp-content/uploads/ok.png" alt="" width="16" height="16" /> ok</td>
</tr>
<tr>
<td style="border-bottom: #4e7db1 solid 1px; padding-left: 5px;">Progression globale</td>
<td style="text-align: center; border-bottom: #4e7db1 solid 1px;">
<p><img title="ok" src="../wp-content/uploads/ok.png" alt="" width="16" height="16" /><img title="ko" src="../wp-content/uploads/ko.png" alt="" width="16" height="16" /> ok/ko</p>
<p>Que sur les gros fichiers</p>
</td>
</tr>
<tr>
<td style="border-bottom: #4e7db1 solid 2px; padding-left: 5px;">Ne nécessite pas une installation particulière</td>
<td style="text-align: center; border-bottom: #4e7db1 solid 2px;"><img title="ko" src="../wp-content/uploads/ko.png" alt="" width="16" height="16" /> ko</td>
</tr>
<tr>
<td style="border-bottom: #4e7db1 solid 1px; padding-left: 5px;">Progression par fichier</td>
<td style="text-align: center; border-bottom: #4e7db1 solid 1px;">
<p><img title="ok" src="../wp-content/uploads/ok.png" alt="" width="16" height="16" /><img title="ko" src="../wp-content/uploads/ko.png" alt="" width="16" height="16" /> ok/ko</p>
<p>Que sur les gros fichiers</p>
</td>
</tr>
<tr>
<td style="border-bottom: #4e7db1 solid 1px; padding-left: 5px;">Vitesse de copie</td>
<td style="text-align: center; border-bottom: #4e7db1 solid 1px;">
<p><img title="ok" src="../wp-content/uploads/ok.png" alt="" width="16" height="16" /><img title="ko" src="../wp-content/uploads/ko.png" alt="" width="16" height="16" /> ok/ko</p>
<p>Que sur les gros fichiers</p>
</td>
</tr>
<tr>
<td style="border-bottom: #4e7db1 solid 1px; padding-left: 5px;">Fichier en cours de copie</td>
<td style="text-align: center; border-bottom: #4e7db1 solid 1px;"><img title="ok" src="../wp-content/uploads/ok.png" alt="" width="16" height="16" /> ok/ko</td>
</tr>
<tr>
</tr>
<tr>
<td style="border-bottom: #4e7db1 solid 1px; padding-left: 5px;">Temps restant fichier</td>
<td style="text-align: center; border-bottom: #4e7db1 solid 1px;">
<p><img title="ok" src="../wp-content/uploads/ok.png" alt="" width="16" height="16" /><img title="ko" src="../wp-content/uploads/ko.png" alt="" width="16" height="16" /> ok/ko</p>
<p>Que sur les gros fichiers</p>
</td>
</tr>
<tr>
<td style="border-bottom: #4e7db1 solid 2px; padding-left: 5px;">Temps restant global</td>
<td style="text-align: center; border-bottom: #4e7db1 solid 2px;"><img title="ko" src="../wp-content/uploads/ko.png" alt="" width="16" height="16" /> ko</td>
</tr>
<tr>
<td style="border-bottom: #4e7db1 solid 1px; padding-left: 5px;">Temps de copie (réel / CPU)</td>
<td style="text-align: center; border-bottom: #4e7db1 solid 1px;">2min 02s / 14s</td>
</tr>
</tbody>
</table>
<p>L&#8217;interface est brouillonne et ne contient<span style="font-weight: bold;"> pas toutes les informations</span>.</p>
<p><br class="spacer_" /></p>
<h3>Utilisation de rsync</h3>
<p>Au détour d&#8217;un forum j&#8217;ai vu que quelqu&#8217;un préconisait d&#8217;utiliser rsync avec l&#8217;option &#8211;progress.</p>
<p><a href="http://voidandany.free.fr/wp-content/uploads/Sélection_0111.png"><img class="aligncenter size-large wp-image-2739" title="rsync progress" src="http://voidandany.free.fr/wp-content/uploads/Sélection_0111-650x316.png" alt="" width="650" height="316" /></a></p>
<p><br class="spacer_" /></p>
<table style="width: 500px;" border="0" cellspacing="0" align="center">
<tbody>
<tr>
<td style="background-color: #4e7db1; color: #ffffff; text-align: center;"><strong>Critère</strong></td>
<td style="background-color: #4e7db1; color: #ffffff; text-align: center;"><strong>Résultat</strong></td>
</tr>
<tr style="border-bottom: #4e7db1 solid 1px;">
<td style="border-bottom: #4e7db1 solid 1px; padding-left: 5px;">Ligne de commande</td>
<td style="border-bottom: #4e7db1 solid 1px; text-align: center;"><img title="ok" src="../wp-content/uploads/ok.png" alt="" width="16" height="16" /> ok</td>
</tr>
<tr>
<td style="border-bottom: #4e7db1 solid 1px; padding-left: 5px;">Copie répertoire</td>
<td style="text-align: center; border-bottom: #4e7db1 solid 1px;"><img title="ok" src="../wp-content/uploads/ok.png" alt="" width="16" height="16" /> ok</td>
</tr>
<tr>
<td style="border-bottom: #4e7db1 solid 1px; padding-left: 5px;">Progression globale</td>
<td style="text-align: center; border-bottom: #4e7db1 solid 1px;"><img title="ko" src="../wp-content/uploads/ko.png" alt="" width="16" height="16" /> ko</td>
</tr>
<tr>
<td style="border-bottom: #4e7db1 solid 2px; padding-left: 5px;">Ne nécessite pas une installation particulière</td>
<td style="text-align: center; border-bottom: #4e7db1 solid 2px;"><img title="ok" src="../wp-content/uploads/ok.png" alt="" width="16" height="16" /> ok</td>
</tr>
<tr>
<td style="border-bottom: #4e7db1 solid 1px; padding-left: 5px;">Progression par fichier</td>
<td style="text-align: center; border-bottom: #4e7db1 solid 1px;"><img title="ok" src="../wp-content/uploads/ok.png" alt="" width="16" height="16" /> ok</td>
</tr>
<tr>
<td style="border-bottom: #4e7db1 solid 1px; padding-left: 5px;">Vitesse de copie</td>
<td style="text-align: center; border-bottom: #4e7db1 solid 1px;"><img title="ok" src="../wp-content/uploads/ok.png" alt="" width="16" height="16" /> ok</td>
</tr>
<tr>
<td style="border-bottom: #4e7db1 solid 1px; padding-left: 5px;">Fichier en cours de copie</td>
<td style="text-align: center; border-bottom: #4e7db1 solid 1px;"><img title="ok" src="../wp-content/uploads/ok.png" alt="" width="16" height="16" /> ok</td>
</tr>
<tr>
</tr>
<tr>
<td style="border-bottom: #4e7db1 solid 1px; padding-left: 5px;">Temps restant fichier</td>
<td style="text-align: center; border-bottom: #4e7db1 solid 1px;"><img title="ok" src="../wp-content/uploads/ok.png" alt="" width="16" height="16" /> ok</td>
</tr>
<tr>
<td style="border-bottom: #4e7db1 solid 2px; padding-left: 5px;">Temps restant global</td>
<td style="text-align: center; border-bottom: #4e7db1 solid 2px;"><img title="ko" src="../wp-content/uploads/ko.png" alt="" width="16" height="16" /> ko</td>
</tr>
<tr>
<td style="border-bottom: #4e7db1 solid 1px; padding-left: 5px;">Temps de copie (réel / CPU)</td>
<td style="text-align: center; border-bottom: #4e7db1 solid 1px;">2min 29s / 1min 33s</td>
</tr>
</tbody>
</table>
<p><br class="spacer_" /></p>
<p>Effectivement rsync répond à pas mal d&#8217;indicateur (<span style="font-weight: bold;">pas de progression totale</span>), on notera aussi la <span style="font-weight: bold;">charge CPU </span>et le temps de copie élevé.</p>
<p><br class="spacer_" /></p>
<h3>Modification de cp directement</h3>
<p>C&#8217;est la solution que j&#8217;ai envisagé en premier, en effet il s&#8217;avère que sur <span style="font-weight: bold;">Gentoo </span>il existe une <span style="font-weight: bold;">option </span>(-g) à la <span style="font-weight: bold;">commande de base cp</span> (ainsi que mv)  qui ajoute une barre de progression.</p>
<p>Il existe un <a href="https://bugs.launchpad.net/ubuntu/+source/coreutils/+bug/64067">bug (n° 64067)</a> dans le launchpad (Ubuntu) mais cela reste un suggestion et Ubuntu attend que cette fonctionnalité soit implémentée dans le upstream (branche commune à toutes les distributions Linux)</p>
<p>Gentoo intégre cette fonctionnalité sous la forme d&#8217;un patch du package coreutils qui ajoute l&#8217;option, les patchs sont disponibles ici :</p>
<p><a href="http://dev.gentoo.org/~vapier/dist/">http://dev.gentoo.org/~vapier/dist/</a></p>
<p><br class="spacer_" /></p>
<p>Il existe bien sur le net des packages pour Debian (<a href="http://true-wing.livejournal.com/53739.html">cp and mv with progress bar</a> ou <a href="http://www.aichler.net/fileutils/patches/">http://www.aichler.net/fileutils/patches/</a>) mais pour la version 6.9 de coreutils de Debian Sarge ou Lenny</p>
<p>Sur <a href="http://krusaf.org/blog/post/2008/08/09/Obtenir-une-progress-bar-avec-les-commandes-cp-et-mv">Obtenir une progress bar avec les commandes cp et mv</a>,  il est mentionné un site (<a hreflang="fr" href="http://druuna.dud-t.org/blog/archives/1217612698_cp_g.txt">Druuna</a>) où la procédure est expliqué malheureusement le site n&#8217;existe plus.</p>
<p><br class="spacer_" /></p>
<p>Enfin un script shell est mis a disposition automatisant le processus de   patch (téléchargement des sources coreutils, du patch, extraction des   archive, patch des sources, compilation et installation des nouveau   binaire), cependant ce dernier est pour la version 6.9 de coreutils or   sous Ubuntu nous somme en 7.4.</p>
<p>Et malheureusement même en adaptant le script (en indiquant les bonnes   archives à télécharger) le script ne fonctionne pas pour la version 7.4</p>
<p><br class="spacer_" /></p>
<p>Bref il s&#8217;agit d&#8217;un <span style="font-weight: bold;">sujet à creuser</span> (un jour peut être)</p>
<p><br class="spacer_" /></p>
<h3>Autres solutions non testées :</h3>
<p><a href="http://forum.ubuntu-fr.org/viewtopic.php?id=82447">Copie avec barre de progression dans un terminal </a>: Copie un seul fichier à la fois</p>
<p><a href="http://forum.ubuntu-fr.org/viewtopic.php?pid=2371813">Forum Ubuntu-fr.org / Equivalent de SuperCopier sous Ubuntu ???</a> : Copie un seul fichier à la fois</p>
<p><a href="http://bash.cyberciti.biz/guide/A_progress_bar_%28gauge_box%29#File_Copy_Progress_Bar_With_Dialog">A progress bar (gauge box) &#8211; Linux Shell Scripting Tutorial &#8211; A Beginner&#8217;s handbook</a> : Source et destination codés dans le script</p>
<p><br class="spacer_" /></p>
<h3>Conclusion :</h3>
<p>Si vous ne souhaitez pas installer quoi que ce soit l&#8217;ajout de la fonction cp_p dans le bashrc est une très bonne solution, si au contraire l&#8217;installation d&#8217;un autre outil ne vous dérange pas vcp (version iinet) est la meilleures solution.</p>
<p><br class="spacer_" /></p>
<p><br class="spacer_" /></p>
<p style="font-weight: bold; font-style: italic; text-decoration: underline;">Sources :</p>
<p><a title="Un cp amélioré: vcp" href="http://blog-marcel.eu/index.php?article30/un-cp-ameliore-vcp">Un cp amélioré: vcp</a></p>
<p><br class="spacer_" /></p>
<p><span style="font-weight: bold; font-style: italic; text-decoration: underline;">Annexe :</span> Pour modifier le Makefile des 2 utilitaires vcp pour permettre leur installation simultannée.</p>
<p>Editer  le /les fichier Makefile présent dans le répertoire de base des sources  des utilitaire puis réaliser la compilation (make et make install)</p>
<p>vcp iinet :</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">CC <span style="color: #339933;">=</span> cc
 CFLAGS <span style="color: #339933;">+=</span> <span style="color: #339933;">-</span>Wall
 PREFIX <span style="color: #339933;">?=</span> <span style="color: #339933;">/</span>usr<span style="color: #339933;">/</span>local
 OBJS <span style="color: #339933;">=</span> main.<span style="color: #202020;">o</span> copyall.<span style="color: #202020;">o</span> copy.<span style="color: #202020;">o</span> screen.<span style="color: #202020;">o</span> log.<span style="color: #202020;">o</span> path.<span style="color: #202020;">o</span> misc.<span style="color: #202020;">o</span> color.<span style="color: #202020;">o</span>
all<span style="color: #339933;">:</span> $<span style="color: #009900;">&#40;</span>OBJS<span style="color: #009900;">&#41;</span>
&nbsp;
 $<span style="color: #009900;">&#40;</span>CC<span style="color: #009900;">&#41;</span> $<span style="color: #009900;">&#40;</span>CFLAGS<span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span>o vcp $<span style="color: #009900;">&#40;</span>OBJS<span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span>lcurses
.<span style="color: #202020;">c</span>.<span style="color: #202020;">o</span><span style="color: #339933;">:</span>
&nbsp;
 $<span style="color: #009900;">&#40;</span>CC<span style="color: #009900;">&#41;</span> $<span style="color: #009900;">&#40;</span>CFLAGS<span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span>c <span style="color: #339933;">-</span>I<span style="color: #339933;">/</span>usr<span style="color: #339933;">/</span>include<span style="color: #339933;">/</span> <span style="color: #339933;">-</span>o $@ $<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>
 .<span style="color: #202020;">SUFFIXS</span><span style="color: #339933;">:</span> .<span style="color: #202020;">c</span> .<span style="color: #202020;">o</span>
install<span style="color: #339933;">:</span>
&nbsp;
 install <span style="color: #339933;">-</span>c <span style="color: #339933;">-</span>m <span style="color: #208080;">0555</span> <span style="color: #339933;">-</span>o root <span style="color: #339933;">-</span>g `.<span style="color: #339933;">/</span>group.<span style="color: #202020;">sh</span>` vcp $<span style="color: #009900;">&#40;</span>PREFIX<span style="color: #009900;">&#41;</span><span style="color: #339933;">/</span>bin
&nbsp;
...</pre></div></div>

<p><br class="spacer_" /></p>
<p>vcp lynix :</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">...
<span style="color: #202020;">install</span><span style="color: #339933;">:</span> vcp
 mkdir <span style="color: #339933;">-</span>p $<span style="color: #009900;">&#40;</span>DESTDIR<span style="color: #009900;">&#41;</span><span style="color: #339933;">/</span>bin
 install <span style="color: #339933;">-</span>m <span style="color: #0000dd;">755</span> vcp $<span style="color: #009900;">&#40;</span>DESTDIR<span style="color: #009900;">&#41;</span><span style="color: #339933;">/</span>bin<span style="color: #339933;">/</span>vcp</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://voidandany.free.fr/index.php/copie-en-ligne-de-commande-avec-une-barre-de-progression-comparatif-solutions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quelques prompts glanés sur le web</title>
		<link>http://voidandany.free.fr/index.php/quelques-prompts-glannes-sur-le-web/</link>
		<comments>http://voidandany.free.fr/index.php/quelques-prompts-glannes-sur-le-web/#comments</comments>
		<pubDate>Mon, 27 Sep 2010 22:23:01 +0000</pubDate>
		<dc:creator>voidAndAny</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[bashrc]]></category>
		<category><![CDATA[PS1]]></category>

		<guid isPermaLink="false">http://voidandany.free.fr/?p=2762</guid>
		<description><![CDATA[En attendant de faire un article sur mon prompt (que je n&#8217;ai pas encore créé), Voici quelques prompts trouvés sur le Web lors de mes recherches. Vous retrouverez le mien encore plus beau et plus pratique ;o) ici :  Mon &#8230; <a href="http://voidandany.free.fr/index.php/quelques-prompts-glannes-sur-le-web/">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><span style="text-decoration: line-through;">En attendant de faire un article sur mon prompt (que je n&#8217;ai pas encore créé), </span></p>
<p>Voici quelques prompts trouvés sur le Web lors de mes recherches.</p>
<p>Vous retrouverez le mien encore plus beau et plus pratique ;o) ici :   <a title="Mon Prompt : le plus beau des prompts" rel="bookmark" href="../index.php/mon-prompt-le-plus-beau-des-prompts/">Mon Prompt : le plus beau des prompts</a></p>
<div></div>
<p><br class="spacer_" /></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">'${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '</span></pre></div></div>

<p style="text-align: center;"><img class="aligncenter size-full wp-image-2763" title="prompt Ubuntu" src="../wp-content/uploads/S%C3%A9lection_0171.png" alt="" width="186" height="20" /><span style="font-size: xx-small;"> </span></p>
<p style="text-align: center;"><span style="font-size: xx-small;">Source : Prompt par défaut sous Ubuntu</span></p>
<p><br class="spacer_" /></p>
<p><br class="spacer_" /></p>
<p><br class="spacer_" /></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"> 
&nbsp;
<span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;\[\033[0;33m\][\!]\<span style="color: #780078;">`if [[ \$? = &quot;0&quot; ]]; then echo &quot;\\[\\033[32m\\]&quot;; else echo &quot;\\[\\033[31m\\]&quot;; fi\`</span>[\u.\h: \<span style="color: #780078;">`if [[ `</span>pwd|wc -c|tr -d &quot;</span> <span style="color: #ff0000;">&quot;<span style="color: #780078;">` &gt; 18 ]]; then echo &quot;\\W&quot;; else echo &quot;\\w&quot;; fi\`</span>]<span style="color: #000099; font-weight: bold;">\$</span>\[\033[0m\] &quot;</span>; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-ne</span> <span style="color: #ff0000;">&quot;\033]0;<span style="color: #780078;">`hostname -s`</span>:<span style="color: #780078;">`pwd`</span>\007&quot;</span></pre></div></div>

<p style="text-align: center;"><img class="size-full wp-image-2767 aligncenter" title="Sélection_021" src="http://voidandany.free.fr/wp-content/uploads/Sélection_021.png" alt="" width="325" height="22" /></p>
<p style="text-align: left;">Et en cas  d&#8217;erreur :</p>
<p style="text-align: center;"><img class="size-full wp-image-2768 aligncenter" title="Sélection_022" src="http://voidandany.free.fr/wp-content/uploads/Sélection_022.png" alt="" width="419" height="38" /><span style="font-size: xx-small;"> </span></p>
<p style="text-align: center;"><span style="font-size: xx-small;">Source : <a href="http://blog.ubrio.us/nix/best-bash-prompt/#high_3">http://blog.ubrio.us/nix/best-bash-prompt/#high_3</a></span></p>
<p>J&#8217;aime : le changement de couleur en cas d&#8217;erreur, le numéro d&#8217;historique, la coupure des chemins &gt; 18 caractères, le titre du terminal</p>
<p><br class="spacer_" /></p>
<p><br class="spacer_" /></p>
<p><br class="spacer_" /></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">GRAY</span>=<span style="color: #ff0000;">&quot;\[\033[1;30m\]&quot;</span>
<span style="color: #007800;">LIGHT_GRAY</span>=<span style="color: #ff0000;">&quot;\[\033[0;37m\]&quot;</span>
<span style="color: #007800;">CYAN</span>=<span style="color: #ff0000;">&quot;\[\033[0;36m\]&quot;</span>
<span style="color: #007800;">LIGHT_CYAN</span>=<span style="color: #ff0000;">&quot;\[\033[1;36m\]&quot;</span>
<span style="color: #007800;">NO_COLOUR</span>=<span style="color: #ff0000;">&quot;\[\033[0m\]&quot;</span>
<span style="color: #007800;">temp</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span>tty<span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #007800;">GRAD1</span>=<span style="color: #800000;">${temp:5}</span>
<span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$TITLEBAR</span><span style="color: #000099; font-weight: bold;">\
</span><span style="color: #007800;">$GRAY</span>-<span style="color: #007800;">$CYAN</span>-<span style="color: #007800;">$LIGHT_CYAN</span>(<span style="color: #000099; font-weight: bold;">\
</span><span style="color: #007800;">$CYAN</span>\u<span style="color: #007800;">$GRAY</span>@<span style="color: #007800;">$CYAN</span>\h<span style="color: #000099; font-weight: bold;">\
</span><span style="color: #007800;">$LIGHT_CYAN</span>)<span style="color: #007800;">$CYAN</span>-<span style="color: #007800;">$LIGHT_CYAN</span>(<span style="color: #000099; font-weight: bold;">\
</span><span style="color: #007800;">$CYAN</span>\#<span style="color: #007800;">$GRAY</span>/<span style="color: #007800;">$CYAN</span><span style="color: #007800;">$GRAD1</span><span style="color: #000099; font-weight: bold;">\
</span><span style="color: #007800;">$LIGHT_CYAN</span>)<span style="color: #007800;">$CYAN</span>-<span style="color: #007800;">$LIGHT_CYAN</span>(<span style="color: #000099; font-weight: bold;">\
</span><span style="color: #007800;">$CYAN</span><span style="color: #000099; font-weight: bold;">\$</span>(date +%H%M)<span style="color: #007800;">$GRAY</span>/<span style="color: #007800;">$CYAN</span><span style="color: #000099; font-weight: bold;">\$</span>(date +%d-%b-%y)<span style="color: #000099; font-weight: bold;">\
</span><span style="color: #007800;">$LIGHT_CYAN</span>)<span style="color: #007800;">$CYAN</span>-<span style="color: #007800;">$GRAY</span>-<span style="color: #000099; font-weight: bold;">\
</span><span style="color: #007800;">$LIGHT_GRAY</span><span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\
</span><span style="color: #007800;">$GRAY</span>-<span style="color: #007800;">$CYAN</span>-<span style="color: #007800;">$LIGHT_CYAN</span>(<span style="color: #000099; font-weight: bold;">\
</span><span style="color: #007800;">$CYAN</span><span style="color: #000099; font-weight: bold;">\$</span><span style="color: #007800;">$GRAY</span>:<span style="color: #007800;">$CYAN</span>\w<span style="color: #000099; font-weight: bold;">\
</span><span style="color: #007800;">$LIGHT_CYAN</span>)<span style="color: #007800;">$CYAN</span>-<span style="color: #007800;">$GRAY</span>-<span style="color: #007800;">$LIGHT_GRAY</span> &quot;</span></pre></div></div>

<p style="text-align: center;"><img class="size-full wp-image-2764 aligncenter" title="prompt" src="http://voidandany.free.fr/wp-content/uploads/Sélection_018.png" alt="" width="463" height="40" /><span style="font-size: xx-small;"> </span></p>
<p style="text-align: center;"><span style="font-size: xx-small;">Source : <a href="http://www.faqs.org/docs/Linux-HOWTO/Bash-Prompt-HOWTO.html#AEN343">http://www.faqs.org/docs/Linux-HOWTO/Bash-Prompt-HOWTO.html#AEN343</a></span></p>
<p>J&#8217;aime : les couleurs, les deux lignes, la date/heure mais pas sous ce format</p>
<p><br class="spacer_" /></p>
<p><br class="spacer_" /></p>
<p><br class="spacer_" /></p>
<p><br class="spacer_" /></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">txtrst</span>=<span style="color: #ff0000;">'\e[0m'</span>    <span style="color: #666666; font-style: italic;"># Text Reset</span>
<span style="color: #007800;">txtbluj</span>=<span style="color: #ff0000;">&quot;\[\e[01;34m\]&quot;</span> <span style="color: #666666; font-style: italic;"># Bleu prompt</span>
<span style="color: #007800;">txtarobasc</span>=<span style="color: #ff0000;">&quot;\[\e[05;33m\]&quot;</span> <span style="color: #666666; font-style: italic;"># Orange clignote prompt</span>
<span style="color: #007800;">txtarobas</span>=<span style="color: #ff0000;">&quot;\[\e[02;33m\]&quot;</span> <span style="color: #666666; font-style: italic;"># Orange prompt</span>
<span style="color: #007800;">txtvertj</span>=<span style="color: #ff0000;">&quot;\[\e[01;32m\]&quot;</span> <span style="color: #666666; font-style: italic;"># Vert fluo prompt</span>
<span style="color: #007800;">txtjaunj</span>=<span style="color: #ff0000;">&quot;\[\e[01;33m\]&quot;</span> <span style="color: #666666; font-style: italic;"># Jaune prompt</span>
<span style="color: #007800;">txtbleucj</span>=<span style="color: #ff0000;">&quot;\[\033[1;36m\]&quot;</span> <span style="color: #666666; font-style: italic;"># Bleu clair prompt</span>
<span style="color: #007800;">txtheure</span>=<span style="color: #ff0000;">&quot;\[\e[02;36m\]&quot;</span> <span style="color: #666666; font-style: italic;"># turquoise, heure prompt</span>
<span style="color: #007800;">txtgrisj</span>=<span style="color: #ff0000;">&quot;\[\e[30;1m\]&quot;</span> <span style="color: #666666; font-style: italic;"># gris prompt</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #007800;">${txtbluj}</span>\u<span style="color: #007800;">${txtrst}</span><span style="color: #007800;">${txtarobasc}</span>@<span style="color: #007800;">${txtrst}</span><span style="color: #007800;">${txtvertj}</span>\h<span style="color: #007800;">${txtrst}</span>:<span style="color: #007800;">${txtjaunj}</span>\w <span style="color: #007800;">${txtrst}</span>(<span style="color: #007800;">${txtbleucj}</span><span style="color: #007800;">$(ls -1 | wc -l | sed 's: ::g')</span> fichiers <span style="color: #007800;">${txtjaunj}</span><span style="color: #007800;">$(ls -lah | grep -m 1 total | sed 's/total //')</span>b<span style="color: #007800;">${txtrst}</span>) <span style="color: #007800;">${txtrst}</span><span style="color: #007800;">${txtbleucj}</span>[<span style="color: #000099; font-weight: bold;">\t</span>]<span style="color: #007800;">${txtgrisj}</span> #\#<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #007800;">${txtgrisj}</span>(jobs:<span style="color: #007800;">${txtbluj}</span>\j<span style="color: #007800;">${txtgrisj}</span>)\<span style="color: #780078;">`if [ \$? = &quot;0&quot; ]; then echo '${txtvertj} :-)'; else echo '${bldred} :-(' ; fi\`</span><span style="color: #007800;">${txtrst}</span><span style="color: #000099; font-weight: bold;">\n</span>$&quot;</span></pre></div></div>

<p style="text-align: center;"><img class="size-full wp-image-2765 aligncenter" title="prompt" src="http://voidandany.free.fr/wp-content/uploads/Sélection_0191.png" alt="" width="437" height="57" /><span style="font-size: xx-small;"> </span></p>
<p style="text-align: center;"><span style="font-size: xx-small;">Source : <a href="Source%20:%20http://www.bordel-de-nerd.net/2010/08/configurer-son-terminal-bash">http://www.bordel-de-nerd.net/2010/08/configurer-son-terminal-base</a></span></p>
<p>J&#8217;aime : le numéro d&#8217;historique discret, l&#8217;heure, le concept du smiley qui change de couleur en cas d&#8217;erreur</p>
<p><br class="spacer_" /></p>
<p><br class="spacer_" /></p>
<p><br class="spacer_" /></p>
<p><br class="spacer_" /></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Color Variables for Prompt</span>
<span style="color: #007800;">GRAD1</span>=<span style="color: #ff0000;">'\333\262\261\260'</span>
<span style="color: #007800;">GRAD2</span>=<span style="color: #ff0000;">'\260\261\262\333'</span>
<span style="color: #007800;">YLOBRN</span>=<span style="color: #ff0000;">'\[\033[01;33;43m\]'</span>
<span style="color: #007800;">WHTBRN</span>=<span style="color: #ff0000;">'\[\033[01;37;43m\]'</span>
<span style="color: #007800;">REDBRN</span>=<span style="color: #ff0000;">'\[\033[01;31;43m\]'</span>
<span style="color: #007800;">BLUBRN</span>=<span style="color: #ff0000;">'\[\033[01;34;43m\]'</span>
<span style="color: #007800;">GRNBRN</span>=<span style="color: #ff0000;">'\[\033[00;32;43m\]'</span>
<span style="color: #007800;">REDBLK</span>=<span style="color: #ff0000;">'\[\033[00;31;40m\]'</span>
<span style="color: #007800;">PPLBLK</span>=<span style="color: #ff0000;">'\[\033[01;35;40m\]'</span>
<span style="color: #007800;">WHTBLK</span>=<span style="color: #ff0000;">'\[\033[01;37;40m\]'</span>
<span style="color: #007800;">NONE</span>=<span style="color: #ff0000;">'\[\033[00m\]'</span>
<span style="color: #007800;">HBLK</span>=<span style="color: #ff0000;">'\[\033[00;30;30m\]'</span>
<span style="color: #007800;">HBLU</span>=<span style="color: #ff0000;">'\[\033[01;34;34m\]'</span>
<span style="color: #007800;">BLU</span>=<span style="color: #ff0000;">'\[\033[01;34m\]'</span>
<span style="color: #007800;">YEL</span>=<span style="color: #ff0000;">'\[\033[01;33m\]'</span>
<span style="color: #007800;">WHT</span>=<span style="color: #ff0000;">'\[\033[01;37m\]'</span>
<span style="color: #007800;">PRPL</span>=<span style="color: #ff0000;">'\[\033[00;35m\]'</span>
<span style="color: #007800;">RED</span>=<span style="color: #ff0000;">'\[\033[01;31m\]'</span>
<span style="color: #007800;">GRN</span>=<span style="color: #ff0000;">'\[\033[01;32m\]'</span>          
<span style="color: #007800;">GRAY</span>=<span style="color: #ff0000;">'\[\033[01;30m\]'</span>
<span style="color: #007800;">PINK</span>=<span style="color: #ff0000;">'\[\033[01;35m\]'</span>
<span style="color: #007800;">NORM</span>=<span style="color: #ff0000;">'\[\033[01;00;0m\]'</span>
<span style="color: #007800;">CYAN</span>=<span style="color: #ff0000;">'\[\033[01;36m\]'</span>
<span style="color: #7a0874; font-weight: bold;">export</span> GRAD1 GRAD2 YLOBRN WHTBRN REDBRN
BLUBRN GRNBRN REDBLK PPLBLK WHTBLK NONE
HBLK HBLU BLU YEL WHT PRPL RED GRN GRAY
PINK NORM CYAN
<span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$CYAN</span>[\s]<span style="color: #007800;">$YEL</span>[<span style="color: #000099; font-weight: bold;">\t</span>] <span style="color: #007800;">$GRN</span>\u<span style="color: #007800;">$YEL</span>@<span style="color: #007800;">$BLU</span>\h <span style="color: #007800;">$WHT</span>[\w]<span style="color: #000099; font-weight: bold;">\$</span><span style="color: #007800;">$NONE</span> <span style="color: #007800;">$NORM</span>&quot;</span></pre></div></div>

<p style="text-align: center;"><img class="size-full wp-image-2766 aligncenter" title="Sélection_020" src="http://voidandany.free.fr/wp-content/uploads/Sélection_020.png" alt="" width="324" height="23" /><span style="font-size: xx-small;"> </span></p>
<p style="text-align: center;"><span style="font-size: xx-small;">Source : <a href="http://www.linuxquestions.org/questions/linux-from-scratch-13/why-does-debian-host-decide-to-ignore-ps1-variable-449425/#post2287912">http://www.linuxquestions.org/questions/linux-from-scratch-13/why-does-debian-host-decide-to-ignore-ps1-variable-449425/#post2287912</a></span></p>
<p>J&#8217;aime : l&#8217;heure</p>
<p><br class="spacer_" /></p>
<p><br class="spacer_" /></p>
<p><br class="spacer_" /></p>
<p><br class="spacer_" /></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">'\n\[\033[1;34m\]\342\226\210\342\226\210 \u @ \w\n\[\033[0;36m\]\342\226\210\342\226\210 \t $ \[\033[0;39m\]'</span></pre></div></div>

<p style="text-align: center;"><img class="size-full wp-image-2769 aligncenter" title="Sélection_023" src="http://voidandany.free.fr/wp-content/uploads/Sélection_023.png" alt="" width="146" height="45" /><span style="font-size: xx-small;"> </span></p>
<p style="text-align: center;"><span style="font-size: xx-small;">Source : <a href="http://ubuntulife.wordpress.com/2010/07/14/top-7-de-prompts-para-la-terminal/">http://ubuntulife.wordpress.com/2010/07/14/top-7-de-prompts-para-la-terminal/</a></span></p>
<p>J&#8217;aime : les couleurs, les 2 lignes, l&#8217;heure, les carrés, la sobriété, c&#8217;est visuellement le plus beau</p>
<p><br class="spacer_" /></p>
<p><br class="spacer_" /></p>
<p><br class="spacer_" /></p>
<p><strong>Rque :</strong> l&#8217;ajout du caractère : au début du prompt et de ; à la fin permet de sélectionner toute la ligne de  commande par un triple clic sur la ligne et de pouvoir la coller en ayant le prompt d&#8217;ignoré :</p>
<p>Sans</p>
<p style="text-align: center;"><img class="size-full wp-image-2775 aligncenter" title="prompt 1" src="http://voidandany.free.fr/wp-content/uploads/prompt-11.gif" alt="" width="444" height="197" /><br class="spacer_" /></p>
<p>Avec</p>
<p style="text-align: center;"><img class="size-full wp-image-2776 aligncenter" title="prompt 2" src="http://voidandany.free.fr/wp-content/uploads/prompt-21.gif" alt="" width="444" height="197" /></p>
<p>Source :<a href="http://www.faqs.org/docs/Linux-HOWTO/Bash-Prompt-HOWTO.html#AEN784">http://www.faqs.org/docs/Linux-HOWTO/Bash-Prompt-HOWTO.html#AEN784</a></p>
]]></content:encoded>
			<wfw:commentRss>http://voidandany.free.fr/index.php/quelques-prompts-glannes-sur-le-web/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Astuce Bash : Prise en compte des fichiers . par le bash</title>
		<link>http://voidandany.free.fr/index.php/astuce-bash-prise-en-compte-des-fichiers-par-le-bash/</link>
		<comments>http://voidandany.free.fr/index.php/astuce-bash-prise-en-compte-des-fichiers-par-le-bash/#comments</comments>
		<pubDate>Sat, 25 Sep 2010 22:09:56 +0000</pubDate>
		<dc:creator>voidAndAny</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[bashrc]]></category>

		<guid isPermaLink="false">http://voidandany.free.fr/?p=2562</guid>
		<description><![CDATA[Je continue mon bashrc et par la même occasion je continue de décrire ici mes découvertes : Cette fois ci il s&#8217;agit de la prise en compte ou non des fichiers / dossiers cachés, commençant par un point par les &#8230; <a href="http://voidandany.free.fr/index.php/astuce-bash-prise-en-compte-des-fichiers-par-le-bash/">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://voidandany.free.fr/wp-content/uploads/shell_97002957_27f6bdfe17_z.jpg"><img class="alignleft size-medium wp-image-2553" style="margin-left: 10px; margin-right: 10px;" title="shell_97002957_27f6bdfe17_z" src="http://voidandany.free.fr/wp-content/uploads/shell_97002957_27f6bdfe17_z-300x225.jpg" alt="" width="300" height="225" /></a>Je continue mon bashrc et par la même occasion je continue de décrire ici mes découvertes :<br class="spacer_" /></p>
<p><br class="spacer_" /></p>
<p>Cette fois ci il s&#8217;agit de la <span style="font-weight: bold;">prise en compte</span> ou non des <span style="font-weight: bold;">fichiers / dossiers cachés</span>, commençant par un point <span style="font-weight: bold;">par les caractère génériques</span>.</p>
<p><br class="spacer_" /></p>
<p>Un exemple sera plus parlant.</p>
<p><br class="spacer_" /></p>
<p>Soit dans un répertoire, 2 fichiers l&#8217;un nommé <span style="font-style: italic;">&laquo;&nbsp;essai</span>&nbsp;&raquo; et l&#8217;autre <span style="font-style: italic;">&laquo;&nbsp;.essai</span>&nbsp;&raquo; (OK c&#8217;est un exemple donc un peu débile).</p>
<p>Par défaut si vous listez les fichiers finissant par <span style="font-style: italic;">&laquo;&nbsp;ssai&nbsp;&raquo;</span> en utilisant le caractère générique * vous aurez ceci :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #000000; font-weight: bold;">*</span>ssai
 essai</pre></div></div>

<p><br class="spacer_" /></p>
<p>Sauf si positionnez l&#8217;option <span style="font-weight: bold;">dotglob </span>avec la commande <span style="font-weight: bold;">shopt </span>:</p>

<div class="wp_syntax"><div class="code"><pre class="avisynth" style="font-family:monospace;">shopt <span style="color:#006600; font-weight:bold;">-</span>s dotglob</pre></div></div>

<p><br class="spacer_" /></p>
<p>Dès lors le comportement de la commande précédente à changée :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #000000; font-weight: bold;">*</span>ssai
 essai  .essai</pre></div></div>

<p><br class="spacer_" /></p>
<p><em><strong>Source : </strong></em></p>
<p><a title="Permalink to Configurer son terminal Bash" href="http://www.bordel-de-nerd.net/2010/08/configurer-son-terminal-bash/#content">Configurer son terminal Bash</a></p>
<p><a href="http://wiki.mandriva.com/fr/Fichiers_et_r%C3%A9pertoires_cach%C3%A9s#Solution_3_:_activer_la_reconnaissance_par_le_shell_du_point_initial">Fichiers et répertoires cachés &#8211; Wiki de la communauté Mandriva</a></p>
]]></content:encoded>
			<wfw:commentRss>http://voidandany.free.fr/index.php/astuce-bash-prise-en-compte-des-fichiers-par-le-bash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Astuce Bash : Sauvegarder dans l&#8217;historique les commandes multi-ligne</title>
		<link>http://voidandany.free.fr/index.php/astuce-bash-sauvegarder-dans-lhistorique-les-commandes-multi-ligne/</link>
		<comments>http://voidandany.free.fr/index.php/astuce-bash-sauvegarder-dans-lhistorique-les-commandes-multi-ligne/#comments</comments>
		<pubDate>Tue, 21 Sep 2010 07:03:53 +0000</pubDate>
		<dc:creator>voidAndAny</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[bashrc]]></category>

		<guid isPermaLink="false">http://voidandany.free.fr/?p=2560</guid>
		<description><![CDATA[Suite des astuces bashrc. Si vous tapez l&#8217;ensemble de commandes suivantes dans votre terminal : for i in 1 2 3 4 5 do echo &#34;Welcome $i times&#34; done Et que vous utilisez les flèches haut et bas pour naviguer &#8230; <a href="http://voidandany.free.fr/index.php/astuce-bash-sauvegarder-dans-lhistorique-les-commandes-multi-ligne/">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://voidandany.free.fr/wp-content/uploads/shell_97002957_27f6bdfe17_z.jpg"><img class="alignleft size-medium wp-image-2553" style="margin-left: 10px; margin-right: 10px;" title="shell_97002957_27f6bdfe17_z" src="http://voidandany.free.fr/wp-content/uploads/shell_97002957_27f6bdfe17_z-300x225.jpg" alt="" width="300" height="225" /></a>Suite des astuces bashrc.</p>
<p><br class="spacer_" /></p>
<p>Si vous tapez l&#8217;ensemble de commandes suivantes dans votre terminal :</p>
<p><br class="spacer_" /></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">for</span> i <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000;">1</span> <span style="color: #000000;">2</span> <span style="color: #000000;">3</span> <span style="color: #000000;">4</span> <span style="color: #000000;">5</span>
<span style="color: #000000; font-weight: bold;">do</span>
 <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Welcome <span style="color: #007800;">$i</span> times&quot;</span>
<span style="color: #000000; font-weight: bold;">done</span></pre></div></div>

<p><br class="spacer_" /></p>
<p><br class="spacer_" /></p>
<p>Et que vous utilisez les flèches haut et bas pour naviguer dans votre historique vous aurez successivement les différentes lignes :</p>
<p style="text-align: center;"><a href="http://voidandany.free.fr/wp-content/uploads/ss-cmdhist.gif"><img class="size-full wp-image-2579 aligncenter" title="sans cmdhist" src="http://voidandany.free.fr/wp-content/uploads/ss-cmdhist.gif" alt="" width="660" height="469" /></a><br class="spacer_" /></p>
<p><br class="spacer_" /></p>
<p>Sauf si vous avez la ligne suivante dans votre .bashrc</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">shopt</span> <span style="color: #660033;">-s</span> cmdhist</pre></div></div>

<p><br class="spacer_" /></p>
<p>La commande multi-ligne est sauvegardée comme une ligne unique dans l&#8217;historique :</p>
<p style="text-align: center;"><a href="http://voidandany.free.fr/wp-content/uploads/avec-cmdhist.gif"><img class="size-full wp-image-2580 aligncenter" title="avec cmdhist" src="http://voidandany.free.fr/wp-content/uploads/avec-cmdhist.gif" alt="" width="660" height="469" /></a></p>
<p style="text-align: center;"> </p>
<p style="text-align: center;"> </p>
<p style="text-align: left;"><span style="text-decoration: underline;"><em><strong>Source : </strong></em></span></p>
<p style="text-align: left;"><a title="Permalink to Configurer son terminal Bash" href="http://www.bordel-de-nerd.net/2010/08/configurer-son-terminal-bash/#content">Configurer son terminal Bash</a></p>
]]></content:encoded>
			<wfw:commentRss>http://voidandany.free.fr/index.php/astuce-bash-sauvegarder-dans-lhistorique-les-commandes-multi-ligne/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Astuce Bash : Corriger automatiquement les fautes de frappe</title>
		<link>http://voidandany.free.fr/index.php/astuce-bash-corriger-automatiquement-les-fautes-de-frappe/</link>
		<comments>http://voidandany.free.fr/index.php/astuce-bash-corriger-automatiquement-les-fautes-de-frappe/#comments</comments>
		<pubDate>Fri, 10 Sep 2010 11:26:56 +0000</pubDate>
		<dc:creator>voidAndAny</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[bashrc]]></category>

		<guid isPermaLink="false">http://voidandany.free.fr/?p=2552</guid>
		<description><![CDATA[Je suis actuellement en train de refaire mon .bashrc, l&#8217;ancien ne satisfaisant pas tout a fait surtout après avoir lu l&#8217;excellent article Configurer son terminal Bash de bordel de nerd Bref je reprends chacune des configurations que j&#8217;ai dans mon &#8230; <a href="http://voidandany.free.fr/index.php/astuce-bash-corriger-automatiquement-les-fautes-de-frappe/">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://voidandany.free.fr/wp-content/uploads/shell_97002957_27f6bdfe17_z.jpg"><img class="alignleft size-medium wp-image-2553" style="margin-left: 10px; margin-right: 10px;" title="shell_97002957_27f6bdfe17_z" src="http://voidandany.free.fr/wp-content/uploads/shell_97002957_27f6bdfe17_z-300x225.jpg" alt="" width="300" height="225" /></a></p>
<p>Je suis actuellement en train de refaire mon <span style="font-weight: bold;">.bashrc</span>, <a href="http://voidandany.free.fr/index.php/ubuntu-minimal-bashrc/">l&#8217;ancien</a> ne satisfaisant pas tout a fait surtout après avoir lu l&#8217;excellent article <a title="Permalink to Configurer son terminal Bash" href="http://www.bordel-de-nerd.net/2010/08/configurer-son-terminal-bash/#content">Configurer son terminal Bash</a> de bordel de nerd<br class="spacer_" /></p>
<p>Bref je reprends chacune des configurations que j&#8217;ai dans mon .bashrc je les compare et ajoute avec celle de bordel de nerd, ce qui est l&#8217;occasion pour moi de découvrir pas mal de chose dont je compte faire des petits articles.</p>
<p><br class="spacer_" /></p>
<p>Pour commencer une astuce spéciale gros doigts.</p>
<p>Si vous avez pour fâcheuse tendance à<span style="font-weight: bold;"> inverser des lettres</span> dans les <span style="font-weight: bold;">chemins </span>que vous tapez, vous allez être content, plus jamais de :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>daat
<span style="color: #c20cb9; font-weight: bold;">bash</span>: <span style="color: #7a0874; font-weight: bold;">cd</span>: <span style="color: #000000; font-weight: bold;">/</span>daat: Aucun fichier ou dossier de ce <span style="color: #7a0874; font-weight: bold;">type</span></pre></div></div>

<p><br class="spacer_" /></p>
<p>Pour mettre en place l&#8217;astuce, très simple il suffit d&#8217;ajouter la ligne suivante à votre ~/.bashrc :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">shopt</span> <span style="color: #660033;">-s</span> cdspell</pre></div></div>

<p><br class="spacer_" /></p>
<p>Et maintenant si vous vous trompez, miracle :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">user<span style="color: #000000; font-weight: bold;">@</span>sweetBox:~$ <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>daat
<span style="color: #000000; font-weight: bold;">/</span>data
user<span style="color: #000000; font-weight: bold;">@</span>sweetBox:<span style="color: #000000; font-weight: bold;">/</span>data$</pre></div></div>

<p><br class="spacer_" /></p>
<p style="font-weight: bold; font-style: italic;">Rque :</p>
<p>Pour supprimer l&#8217;option :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">shopt</span> <span style="color: #660033;">-u</span> cdspell</pre></div></div>

<p>Pour lister les option possibles :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">shopt</span>
autocd          off
cdable_vars     off
cdspell         on
checkhash       off
checkjobs       off
checkwinsize    off
cmdhist         on
compat31        off
compat32        off
compat40        off
dirspell        off
dotglob         off
execfail        off
expand_aliases  on
extdebug        off
extglob         on
extquote        on
failglob        off
force_fignore   on
globstar        off
gnu_errfmt      off
histappend      on
histreedit      off
histverify      off
hostcomplete    off
huponexit       off
interactive_comments    on
lithist         off
login_shell     off
mailwarn        off
no_empty_cmd_completion off
nocaseglob      off
nocasematch     off
nullglob        off
progcomp        on
promptvars      on
restricted_shell        off
shift_verbose   off
sourcepath      on
xpg_echo        off
 </pre></div></div>

<p style="font-weight: bold; font-style: italic;">Sources :</p>
<p>Image par <a href="http://www.flickr.com/photos/christinamatheson/">Christina Matheson</a> sous CC BY-NC-SA</p>
]]></content:encoded>
			<wfw:commentRss>http://voidandany.free.fr/index.php/astuce-bash-corriger-automatiquement-les-fautes-de-frappe/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Avoir un prompt en couleur avec Putty</title>
		<link>http://voidandany.free.fr/index.php/couleur-prompt-avec-putty/</link>
		<comments>http://voidandany.free.fr/index.php/couleur-prompt-avec-putty/#comments</comments>
		<pubDate>Fri, 04 Jun 2010 09:13:11 +0000</pubDate>
		<dc:creator>voidAndAny</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[putty]]></category>

		<guid isPermaLink="false">http://voidandany.free.fr/?p=2273</guid>
		<description><![CDATA[Lorsque l&#8217;on se sert de Putty pour se connecter en SSH sur un serveur Linux, par défaut le prompt est en noir et blanc : Cela vient du fait que Putty envoi comme chaine caractérisant le terminal &#171;&#160;xterm&#160;&#187; au lieu &#8230; <a href="http://voidandany.free.fr/index.php/couleur-prompt-avec-putty/">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Lorsque l&#8217;on se sert de <span style="font-weight: bold;">Putty </span>pour se connecter en SSH sur un serveur Linux, par défaut le <span style="font-weight: bold;">prompt </span>est en <span style="font-weight: bold;">noir et blanc</span> :</p>
<p style="text-align: center;"><a href="http://voidandany.free.fr/wp-content/uploads/2010-06-04_110259.png"><img class="size-full wp-image-2275 aligncenter" title="Putty xterm noir et blanc" src="http://voidandany.free.fr/wp-content/uploads/2010-06-04_110259.png" alt="Putty xterm noir et blanc" width="315" height="108" /></a></p>
<p><br class="spacer_" /></p>
<p>Cela vient du fait que Putty envoi comme chaine caractérisant le terminal &laquo;&nbsp;xterm&nbsp;&raquo; au lieu de &laquo;&nbsp;<span style="font-weight: bold;">xterm-color</span>&laquo;&nbsp;, il suffit donc de le changer dans :</p>
<p>Connection &gt; Data &gt; Terminal details &gt; <span style="font-weight: bold;">Terminal-type string</span></p>
<p style="text-align: center;"><a href="http://voidandany.free.fr/wp-content/uploads/2010-06-04_105117.png"><img class="size-full wp-image-2276 aligncenter" title="Putty terminal type" src="http://voidandany.free.fr/wp-content/uploads/2010-06-04_105117.png" alt="Putty terminal type" width="454" height="436" /></a></p>
<p><br class="spacer_" /></p>
<p>Et voila le résultat :</p>
<p style="text-align: center;"><a href="http://voidandany.free.fr/wp-content/uploads/2010-06-04_110404.png"><img class="size-full wp-image-2277 aligncenter" title="Putty xterm-color en couleur" src="http://voidandany.free.fr/wp-content/uploads/2010-06-04_110404.png" alt="" width="316" height="108" /></a></p>
<p><br class="spacer_" /></p>
<p>Ce n&#8217;est pas révolutionnaire mais ca permet de jouer avec le paramétrage de la chaine PS1 dans les fichiers ~/.bashrc ou /etc/bash.bashrc :</p>
<p><br class="spacer_" /></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">case</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$TERM</span>&quot;</span> <span style="color: #000000; font-weight: bold;">in</span>
 xterm-color<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #007800;">color_prompt</span>=<span style="color: #c20cb9; font-weight: bold;">yes</span><span style="color: #000000; font-weight: bold;">;;</span>
<span style="color: #000000; font-weight: bold;">esac</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$color_prompt</span>&quot;</span> = <span style="color: #c20cb9; font-weight: bold;">yes</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
 <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">'${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '</span>
<span style="color: #000000; font-weight: bold;">else</span>
 <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">'${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '</span>
<span style="color: #000000; font-weight: bold;">fi</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://voidandany.free.fr/index.php/couleur-prompt-avec-putty/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Ubuntu minimal &#8211; bashrc</title>
		<link>http://voidandany.free.fr/index.php/ubuntu-minimal-bashrc/</link>
		<comments>http://voidandany.free.fr/index.php/ubuntu-minimal-bashrc/#comments</comments>
		<pubDate>Wed, 13 May 2009 19:47:03 +0000</pubDate>
		<dc:creator>voidAndAny</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[bash]]></category>

		<guid isPermaLink="false">http://voidandany.free.fr/?p=371</guid>
		<description><![CDATA[Après avoir installé une machine sous Ubuntu, une des première configuration que je réalise est de personnaliser mon bashrc. Cékoidonc bashrc ? Ce fichier contient un ensemble de paramétrage du bash (c&#8217;est à dire de la ligne de commande) dont &#8230; <a href="http://voidandany.free.fr/index.php/ubuntu-minimal-bashrc/">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Après avoir installé une machine sous Ubuntu, une des première configuration que je réalise est de personnaliser mon bashrc.</p>
<p><br class="spacer_" /></p>
<p>Cékoidonc <strong>bashrc </strong>?</p>
<p>Ce fichier contient un ensemble de paramétrage du bash (c&#8217;est à dire de la ligne de commande) dont la plus utilisé les alias.</p>
<p><br class="spacer_" /></p>
<p>Cékoidonc les <strong>alias </strong>?</p>
<p>Les alias sont des raccourcis de commande</p>
<p><br class="spacer_" /></p>
<p>Un exemple, pour lister le contenu d&#8217;un répertoire on fait un ls.</p>
<p>Problème les informations retourné par cette commande sont succintes (nom des fichiers et répertoires).</p>
<p>On peut donc faire un ls -lhA, où l&#8217;option l indique que l&#8217;on veut le résultat en liste détaillé, le h affiche les tailles dans un format lisible par un humain (1K 234M 2G) et le A pour afficher les fichiers et repertoires cachés, les liens symboliques mais pas les dossiers . et ..</p>
<p>On le voit ça devient fastidieux de toujours faire un ls -lhA d&#8217;où l&#8217;utilité de l&#8217;alias suivant dans le bashrc :<br />
 alias ll=&#8217;ls -lhA&#8217;</p>
<p>Du coup pour avoir le même résultat que ls -lhA on a juste à taper ll. Les alias sont très pratiques et quand on en a pris l&#8217;habitude il est difficile d&#8217;arriver sur un machine n&#8217;ayant pas d&#8217;alias ou ayant des alias différents.</p>
<p><br class="spacer_" /></p>
<p>Je parle d&#8217;un fichier bashrc mais on devrait plutôt parler des fichierS bashrc, en effet ce dernier peut être à <strong>plusieurs endroits</strong> avec des noms différents :</p>
<ul>
<li>/etc/bash/bashrc : les configurations qu&#8217;il contient affectent tous les utilisateurs</li>
<li> ~/.bashrc : n&#8217;affecte que l&#8217;utilisateur dans le répertoire duquel il se trouve</li>
</ul>
<p><br class="spacer_" /></p>
<p>Dans mon cas j&#8217;ai opté pour le premier choix, en effet j&#8217;ai plusieurs utilisateur mais qui sont utilisés par moi-même&#8230;</p>
<p><br class="spacer_" /></p>
<p><br class="spacer_" /></p>
<p>Ci-dessous mon fichier bashrc, il est normalement pas trop mal commenté je n&#8217;en dirais donc pas plus.</p>
<p><br class="spacer_" /></p>
<p><span id="more-371"></span></p>
<p><br class="spacer_" /></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># ~/.bashrc: executed by bash(1) for non-login shells.</span>
<span style="color: #666666; font-style: italic;"># see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)</span>
<span style="color: #666666; font-style: italic;"># for examples</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># If not running interactively, don't do anything</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-z</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$PS1</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000; font-weight: bold;">&amp;</span>amp; <span style="color: #7a0874; font-weight: bold;">return</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># don't put duplicate lines in the history. See bash(1) for more options</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">HISTCONTROL</span>=ignoredups
<span style="color: #666666; font-style: italic;"># ... and ignore same sucessive entries.</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">HISTCONTROL</span>=ignoreboth
&nbsp;
<span style="color: #666666; font-style: italic;"># lignes de l'historique par session bash</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">HISTSIZE</span>=<span style="color: #000000;">5000</span>
<span style="color: #666666; font-style: italic;"># lignes de l'historique conservées</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">HISTFILESIZE</span>=<span style="color: #000000;">20000</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># check the window size after each command and, if necessary,</span>
<span style="color: #666666; font-style: italic;"># update the values of LINES and COLUMNS.</span>
<span style="color: #7a0874; font-weight: bold;">shopt</span> <span style="color: #660033;">-s</span> checkwinsize
&nbsp;
<span style="color: #666666; font-style: italic;"># make less more friendly for non-text input files, see lesspipe(1)</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-x</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>lesspipe <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000; font-weight: bold;">&amp;</span>amp; <span style="color: #7a0874; font-weight: bold;">eval</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$(lesspipe)</span>&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># set a fancy prompt (non-color, unless we know we &quot;want&quot; color)</span>
<span style="color: #000000; font-weight: bold;">case</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$TERM</span>&quot;</span> <span style="color: #000000; font-weight: bold;">in</span>
xterm-color<span style="color: #7a0874; font-weight: bold;">&#41;</span>
    <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;[<span style="color: #000099; font-weight: bold;">\t</span>] \[\e[01;32m\]\u@\h\[\e[00m\]:\[\e[01;34m\]\w\[\e[00m\]<span style="color: #000099; font-weight: bold;">\$</span> &quot;</span>
    <span style="color: #000000; font-weight: bold;">;;</span>
<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
    <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">'${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '</span>
    <span style="color: #000000; font-weight: bold;">;;</span>
<span style="color: #000000; font-weight: bold;">esac</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># If this is an xterm set the title to user@host:dir</span>
<span style="color: #000000; font-weight: bold;">case</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$TERM</span>&quot;</span> <span style="color: #000000; font-weight: bold;">in</span>
xterm<span style="color: #000000; font-weight: bold;">*|</span>rxvt<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
    <span style="color: #007800;">PROMPT_COMMAND</span>=<span style="color: #ff0000;">'echo -ne &quot;\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007&quot;'</span>
    <span style="color: #000000; font-weight: bold;">;;</span>
<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
    <span style="color: #000000; font-weight: bold;">;;</span>
<span style="color: #000000; font-weight: bold;">esac</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Alias definitions.</span>
<span style="color: #666666; font-style: italic;"># You may want to put all your additions into a separate file like</span>
<span style="color: #666666; font-style: italic;"># ~/.bash_aliases, instead of adding them here directly.</span>
<span style="color: #666666; font-style: italic;"># See /usr/share/doc/bash-doc/examples in the bash-doc package.</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#if [ -f ~/.bash_aliases ]; then</span>
<span style="color: #666666; font-style: italic;">#    . ~/.bash_aliases</span>
<span style="color: #666666; font-style: italic;">#fi</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># enable color support of ls and also add handy aliases</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$TERM</span>&quot;</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;dumb&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #7a0874; font-weight: bold;">eval</span> <span style="color: #ff0000;">&quot;<span style="color: #780078;">`dircolors -b`</span>&quot;</span>
    <span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">ls</span>=<span style="color: #ff0000;">'ls --color=auto -F'</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># enable programmable completion features (you don't need to enable</span>
<span style="color: #666666; font-style: italic;"># this, if it's already enabled in /etc/bash.bashrc and /etc/profile</span>
<span style="color: #666666; font-style: italic;"># sources /etc/bash.bashrc).</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>bash_completion <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
    . <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>bash_completion
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># lecture colorée de logs</span>
logview<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #7a0874; font-weight: bold;">&#123;</span>
    ccze <span style="color: #660033;">-A</span> <span style="color: #000000; font-weight: bold;">&amp;</span>lt; <span style="color: #007800;">$1</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">less</span> <span style="color: #660033;">-R</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># lecture colorée de logs en directfunction logview()</span>
logtail<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #7a0874; font-weight: bold;">&#123;</span>
    <span style="color: #c20cb9; font-weight: bold;">tail</span> <span style="color: #660033;">-f</span> <span style="color: #007800;">$1</span> <span style="color: #000000; font-weight: bold;">|</span> ccze
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Pour compter les mails non lus dans un maildir :</span>
<span style="color: #000000; font-weight: bold;">function</span> cm <span style="color: #7a0874; font-weight: bold;">&#123;</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Inbox: <span style="color: #007800;">$(find -L ~/Maildir/  -type f -regex '.*/new/.*'| wc -l)</span>&quot;</span> ;
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> mkcd <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #666666; font-style: italic;">#Crée un dossier avec le nom passé en paramétre et va dedans</span>
<span style="color: #7a0874; font-weight: bold;">&#123;</span>
  <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #007800;">$1</span> <span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000; font-weight: bold;">&amp;</span>amp; <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #007800;">$1</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Pour définir l'éditeur par défaut utilisé par de nombreuses commandes (vipw, visudo, less, cvs, svn...) :</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">EDITOR</span>=<span style="color: #c20cb9; font-weight: bold;">vim</span> <span style="color: #666666; font-style: italic;"># ou nano ou vim / emacs</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># ALIAS</span>
<span style="color: #666666; font-style: italic;"># Calendrier du mois en cours, en rouge le jour actuel</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">cal</span>=<span style="color: #ff0000;">'var=$(cal -m); echo &quot;${var/$(date +%-d)/$(echo -e &quot;\033[1;31m$(date +%-d)\033[0m&quot;)}&quot;'</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">ll</span>=<span style="color: #ff0000;">'ls -lhA'</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">l</span>=<span style="color: #ff0000;">'ls -lh'</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">i</span>=<span style="color: #ff0000;">&quot;sudo aptitude install&quot;</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">u</span>=<span style="color: #ff0000;">&quot;sudo aptitude update&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># extraire une archive tar.gz</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">x</span>=<span style="color: #ff0000;">'tar xzvf'</span>
<span style="color: #666666; font-style: italic;"># extraire une archive tar.bz2</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">xj</span>=<span style="color: #ff0000;">'tar xjvf'</span>
<span style="color: #666666; font-style: italic;"># créer une archive tar.gz</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">c</span>=<span style="color: #ff0000;">'tar czvf'</span>
<span style="color: #666666; font-style: italic;"># créer une archive tar.bz2</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">cj</span>=<span style="color: #ff0000;">'tar cjvf'</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Pour les gros doigts</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> cd..=<span style="color: #ff0000;">'cd ..'</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">grpe</span>=<span style="color: #ff0000;">'grep'</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">mroe</span>=<span style="color: #ff0000;">'more'</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">iv</span>=<span style="color: #ff0000;">'vi'</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">tial</span>=<span style="color: #ff0000;">'tail'</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">xs</span>=<span style="color: #ff0000;">'cd'</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">vf</span>=<span style="color: #ff0000;">'cd'</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> ..=<span style="color: #ff0000;">' cd ..'</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Remonter d'un dossier et ls</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">up</span>=<span style="color: #ff0000;">&quot;cd .. &amp;amp;&amp;amp; ls --color&quot;</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">du</span>=<span style="color: #ff0000;">'du -h --max-depth=1'</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">dusort</span>=<span style="color: #ff0000;">'du -x --block-size=1048576 | sort -nr'</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">df</span>=<span style="color: #ff0000;">'df -h'</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">sd</span>=<span style="color: #ff0000;">'sudo shutdown -h now'</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">sr</span>=<span style="color: #ff0000;">'sudo shutdown -r now'</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Creation des répertoires parents</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">mkdir</span>=<span style="color: #ff0000;">'mkdir -p'</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Stop freevo</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">freevostop</span>=<span style="color: #ff0000;">'sudo /etc/init.d/freevo stop'</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://voidandany.free.fr/index.php/ubuntu-minimal-bashrc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
