<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.yobi.be/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=86.140.1.253</id>
	<title>YobiWiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.yobi.be/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=86.140.1.253"/>
	<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Special:Contributions/86.140.1.253"/>
	<updated>2026-04-28T00:31:05Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=Bash_Tips&amp;diff=1538</id>
		<title>Bash Tips</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Bash_Tips&amp;diff=1538"/>
		<updated>2006-11-29T17:29:01Z</updated>

		<summary type="html">&lt;p&gt;86.140.1.253: /* Sous MC */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Documentation==&lt;br /&gt;
* [http://ldp.unixtech.be/LDP/abs/html/index.html Advanced Bash-Scripting Guide]&lt;br /&gt;
* http://www.ss64.com/bash/index.html&lt;br /&gt;
* http://tille.xalasys.com/training/bash&lt;br /&gt;
&lt;br /&gt;
==Sous MC==&lt;br /&gt;
&lt;br /&gt;
* Pour pouvoir faire des sélections à la souris (gpm ou X) sans que mc ne les interprète, tenir la touche shift enfoncée&lt;br /&gt;
* J&#039;aime lancer mes mc root avec un alias qui me met un fond rouge plutot que bleu, l&#039;idée vient de Damn Small Linux mais ici en employant les options mc:&lt;br /&gt;
 alias smc=&#039;sudo -H mc --colors normal=,red:selected=,brightmagenta:marked=,red:markselect=,brightmagenta:directory=,red:executable=,red:link=,red:stalelink=brightcyan,red:device=,red:special=,red:core=,red:input=,green /root&#039;&lt;br /&gt;
* ctrl+o: toggler l&#039;affichage console/mc&lt;br /&gt;
* alt+o:  meme pwd dans l&#039;autre fenetre&lt;br /&gt;
* alt+enter: copie sur la ligne de commande la ou le curseur se trouve&lt;br /&gt;
* *: inverse la selection&lt;br /&gt;
* +: permet de selectionner selon un filtre (+ et enter prend directement tout ce qui se trouve dans le repertoire courant)&lt;br /&gt;
* -: permet de deselectionner avec un filtre&lt;br /&gt;
* ctrl+u: undo&lt;br /&gt;
* mc permet d&#039;ouvrir directement un ftp, d&#039;ouvrir les targz, les rpm, les deb, les iso, ... en fait tout ce qui possède une système de fichiers&lt;br /&gt;
&lt;br /&gt;
* Si il y a un probleme avec la touche alt (qui ne fonctionne pas en tant que touche &amp;quot;meta&amp;quot;): options -&amp;gt; display bits -&amp;gt; 3eme: uncheck le 8-bits&lt;br /&gt;
&lt;br /&gt;
==Séquences de couleur ISO 6429 (ANSI)==&lt;br /&gt;
 echo -e &amp;quot;Test \033[31mrouge\033[m&amp;quot;&lt;br /&gt;
 echo -e &amp;quot;Test \033[1;31mrouge vif\033[m&amp;quot;&lt;br /&gt;
 echo -e &amp;quot;Test \033[32mvert\033[m&amp;quot;&lt;br /&gt;
 echo -e &amp;quot;Test \033[1;31mvert vif\033[m&amp;quot;&lt;br /&gt;
 man dir_colors&lt;br /&gt;
&lt;br /&gt;
 ESC[rowsA          Cursor up&lt;br /&gt;
 ESC[rowsB          Cursor down&lt;br /&gt;
 ESC[colsC          Cursor right&lt;br /&gt;
 ESC[colsD          Cursor left&lt;br /&gt;
 ESC[row;colH       Set cursor position (top left is row 1, column 1)&lt;br /&gt;
 ESC[2J             Clear screen&lt;br /&gt;
 ESC[K              Clear from cursor to end of line&lt;br /&gt;
 ESC[row;colf       Set cursor position, same as &amp;quot;H&amp;quot; command&lt;br /&gt;
 ESC[=modeh         Set display mode; see table of mode values below&lt;br /&gt;
 ESC[=model         Set display mode; see table of mode values below&lt;br /&gt;
 ESC[attr;attr;..m  Set display attributes; see table of attribute values below&lt;br /&gt;
 ESC[key;string;..p Substitute &amp;quot;string&amp;quot; for the specified key; see key substitutions section below.&lt;br /&gt;
 ESC[s              Save cursor position (may not be nested)&lt;br /&gt;
 ESC[u              Restore cursor position after a save&lt;br /&gt;
===Attribute Description===&lt;br /&gt;
*0 All attributes off (normal white on black)&lt;br /&gt;
*1 High intensity (bold)&lt;br /&gt;
*2 Normal intensity&lt;br /&gt;
*4 Underline (usually effective only on monochrome displays)&lt;br /&gt;
*5 Blinking&lt;br /&gt;
*7 Reverse Video&lt;br /&gt;
*8 Invisible&lt;br /&gt;
*30-37 Set the foreground color: 30=Black 31=Red 32=Green 33=Yellow 34=Blue 35=Magenta 36=Cyan 37=White&lt;br /&gt;
*40-47 Set the background color: 40=Black 41=Red 42=Green 43=Yellow 44=Blue 45=Magenta 46=Cyan 47=White&lt;br /&gt;
Settings are cumulative, so (for example) to set bright red foreground set all attributes off, then set red, then bold: echo _[0;31;1m.&lt;br /&gt;
===Display Modes===&lt;br /&gt;
*0 Text 40x25 monochrome&lt;br /&gt;
*1 Text 40x25 color&lt;br /&gt;
*2 Text 80x25 monochrome&lt;br /&gt;
*3 Text 80x25 color&lt;br /&gt;
*4 Graphics 320x200 4-color&lt;br /&gt;
*5 Graphics 320x200 4-color&lt;br /&gt;
*6 Graphics 640x200 2-color&lt;br /&gt;
*7 (cursor wrap kludge)&lt;br /&gt;
Mode 7 is an unfortunate kludge; Setting mode 7 with an &amp;quot;h&amp;quot; command tells ANSI to wrap text to the next line when it passes the end of a line; setting mode 7 with an &amp;quot;l&amp;quot; (lower-case L) command tells ANSI not to wrap text. For all other modes the &amp;quot;h&amp;quot; and &amp;quot;l&amp;quot; commands are equivalent.&lt;br /&gt;
===Key Substitutions===&lt;br /&gt;
The key substitutions (&amp;quot;p&amp;quot;) command causes ANSI to substitute the text in &amp;quot;string&amp;quot; when the specified key is pressed. The key code can be a single character in quotes, a numeric ASCII value, or an extended code for a non ASCII key (e.g. function or cursor keys) in the form 0;n, where n is the scan code for the key. The string to be substituted can be a single character or character string in quotes, a numeric ASCII value, or an extended key code.&lt;br /&gt;
&amp;lt;br&amp;gt;For a list of numeric ASCII values, see ASCII Tables. For a list of extended key codes see Key Code and Scan Code Tables.&lt;br /&gt;
&amp;lt;br&amp;gt;To clear a key substitution, &amp;quot;substitute&amp;quot; the original key for itself.&lt;br /&gt;
&lt;br /&gt;
==TAB completion==&lt;br /&gt;
* Avoid the bell: add &amp;quot;set bell-style visible&amp;quot; to ~/.inputrc (versus audible and none)&lt;br /&gt;
* Discover the rules when completing a given command, e.g. acroread: complete|grep acroread&lt;br /&gt;
&amp;lt;br&amp;gt;Rules are in /etc/bash_completion and loaded in the environment (see set)&lt;br /&gt;
* See http://aplawrence.com/Unix/customtab.html&lt;br /&gt;
** Enabling custom completions: shopt -s progcomp&lt;br /&gt;
** Registering a custom function to complete command line of e.g. myprog: complete -F _myprog -o dirnames myprog&lt;br /&gt;
** Creating the custom function:&lt;br /&gt;
 _myprog()&lt;br /&gt;
 {&lt;br /&gt;
    local curw&lt;br /&gt;
    COMPREPLY=()&lt;br /&gt;
    curw=${COMP_WORDS[COMP_CWORD]}&lt;br /&gt;
    COMPREPLY=($(compgen -A user -- $curw))&lt;br /&gt;
    return 0&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
==Misc==&lt;br /&gt;
&lt;br /&gt;
Pay attention when using &#039;&#039;&#039;sudo&#039;&#039;&#039; that $HOME is still configured as yours and you could end up with some user config files owned by root in your own directory.&lt;br /&gt;
&amp;lt;br&amp;gt;To avoid that, use &amp;quot;sudo -H&amp;quot; or to make it definitive, use visudo to add to the sudo conf: &amp;quot;Defaults always_set_home&amp;quot;&lt;br /&gt;
&lt;br /&gt;
To convert ASCII  Mac file to Unix file:&lt;br /&gt;
 for file in *; do cat &amp;quot;$file&amp;quot; | tr \\15 \\12 &amp;gt;e;mv e &amp;quot;$file&amp;quot;; done&lt;br /&gt;
&lt;br /&gt;
To convert a filename from uppercase to lowercase&lt;br /&gt;
 for file in * ; do mv &amp;quot;$file&amp;quot; &amp;quot;$(echo -n $file|tr [[A-Z] [[a-z])&amp;quot; ; done&lt;br /&gt;
&lt;br /&gt;
Boot Disk :&lt;br /&gt;
 mkbootdisk numero version : voir version dans /lib/modules/2....&lt;br /&gt;
 ou rdev -h : aide&lt;br /&gt;
 rdev /boot/kernel - &amp;lt; nom du noyau&lt;br /&gt;
 dd if=/boot/linux of=/dev/fd0 bs=8192&lt;br /&gt;
&lt;br /&gt;
Conversion Ext2 -&amp;gt; Ext3&lt;br /&gt;
&lt;br /&gt;
 tune2fs -j /dev/hdXX&lt;br /&gt;
And don&#039;t forget to adapt fstab entry&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Devinette===&lt;br /&gt;
&lt;br /&gt;
What is the output of this command?&lt;br /&gt;
&amp;lt;verbatim&amp;gt;&lt;br /&gt;
echo one&amp;gt;/tmp/t;(echo two&amp;gt;/dev/stdout)&amp;gt;&amp;gt;/tmp/t;cat /tmp/t&lt;br /&gt;
&amp;lt;/verbatim&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, try...&lt;br /&gt;
&amp;lt;br&amp;gt;Astonishing, isn&#039;t it?!&lt;br /&gt;
&amp;lt;br&amp;gt;PS: to get what you expected, try &amp;gt;&amp;gt;/dev/stdout&lt;br /&gt;
&lt;br /&gt;
Apparently when the command is executed, the sub-process is launched with /dev/stdout pointing to its /proc/self/fd/1 but this one is now set to /tmp/t so the sub-shell re-opens the file and overwrites it!&lt;br /&gt;
&lt;br /&gt;
Note that under cygwin/bash, there is no real /dev/stdout and the result is one two&lt;br /&gt;
&lt;br /&gt;
echo one&amp;gt;/tmp/t;m=$(echo two&amp;gt;/dev/stdout);echo $m&amp;gt;&amp;gt;/tmp/t;cat /tmp/t&lt;br /&gt;
is working as expected, /proc/self/fd/1 of the sub-process is now a pipe to the main process.&lt;br /&gt;
&lt;br /&gt;
So a program is able to detect if its output was redirected or not!&lt;/div&gt;</summary>
		<author><name>86.140.1.253</name></author>
	</entry>
</feed>