<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <link REL="STYLESHEET" TYPE="text/css" TITLE="Style DILIB" HREF="../../dilib.css"> <title>Commandes de base - UNIX</title> <style type="text/css"> Q { font-style: italic; } TABLE { text-align: center; } </style> <link rel="copyright" href="http://www.inist.fr/"><link rel="author" href="http://dilib.inist.fr/membres.html"><link rel="chapter" href="caracteristiques.fre.html" title="UNIX"><link rel="chapter" href="X.fre.html" title="X Window"><link rel="chapter" href="redirPipes.fre.html" title="Rappels"><link rel="chapter" href="newCommandsUser.fre.html" title="Commandes UNIX"><link rel="chapter" href="shellVars.fre.html" title="Shell"><link rel="chapter" href="sed.fre.html" title="Sed"><link rel="chapter" href="make.fre.html" title="Make"><link rel="index" href="http://dilib.inist.fr/dilib/v04Main/IndexSite/Server/FR.resource.index.html"><link rel="top" title="Accueil de DILIB" href="http://dilib.inist.fr/dilib/v04Main/"><link rel="alternate" title="English version" href="commandesBase.eng.html"><link rel="up" href="index.fre.html" title="Tutorial UNIX / Shell"> <link rel="section" href="redirPipes.fre.html" title="Redirections"><link rel="section" href="commandesBase.fre.html" title="Base"><link rel="section" href="tpRappels.fre.html" title="TP"> <link rel="first" href="caracteristiques.fre.html" title="Caractéristiques d'UNIX"> <link rel="previous" href="redirPipes.fre.html#wm" title="Redirections"> <link rel="next" href="tpRappels.fre.html" title="Travaux Pratiques"> <link rel="last" href="tpRappels.fre.html" title="Travaux Pratiques"> </head> <body> <h1>Commandes de base Unix</h1> <div id="navcontainer"> <ul id="navlist"> <li><a href="caracteristiques.fre.html">UNIX</a> </li> <li><a>Bases</a> <ul id="subnavlist"> <li><a href="redirPipes.fre.html">Redirections</a></li> <li><a href="commandesBase.fre.html" id="subcurrent">Base</a></li> <li><a href="tpRappels.fre.html">TP</a></li> </ul> </li> <li><a href="newCommandsUser.fre.html">Commandes</a> </li> <li><a href="shellVars.fre.html">Shell</a> </li> <li><a href="sed.fre.html">Sed</a> </li> <li><a href="make.fre.html">Make</a> </li> </ul> </div> <div class="content"> <table bgcolor="white" border="1" class="var" style="margin-left:0;"> <tr> <th>nom</th> <th>syntaxe</th> <th>définition</th> <th>exemple</th> </tr> <tr> <th>cat</th> <td><pre>cat [<i>file</i>]</pre></td> <td>Lecture du contenu de fichiers</td> <td><code>cat file.txt</code></td> </tr> <tr> <th>cat</th> <td><pre>cat [<i>file</i>]... cat < ... >...</pre> </td> <td>Concaténation de fichiers</td> <td><code>cat file1.txt file2.txt > file3.txt</code></td> </tr> <tr> <th>cd</th> <td><code>cd [<i>newWD</i>]</code> </td> <td>Changement de <code>working directory</code><br><font color="red">à utiliser avec modération, penser aux chemins relatifs</font></td> <td> <code>cd</code><br> <code>cd Formation/TP1</code><br> <code>cd -</code></td> </tr> <tr> <th>cp</th> <td><code>cp <i>inputFile</i> <i>targetFile</i></code> </td> <td>Copie d'un fichier</td> <td><code>cp exo.sh exo1.sh</code></td> </tr> <tr> <th>date</th> <td><code>date </code> </td> <td>Affichage date et heure système</td> <td><code>date</code></td> </tr> <tr> <th>grep</th> <td><code>grep <i>expr</i> <... </code> </td> <td>Sélection des lignes contenant l'expression indiquée</td> <td><code>grep "<dc:creator>" < file.xml</code></td> </tr> <tr> <th>head</th> <td><code>head [-n] </code> </td> <td>Sélection du début d'un fichier (en nombre de lignes)</td> <td><code>head -1 < table.txt</code></td> </tr> <tr> <th>history</th> <td><code>history [-n] </code> </td> <td>Historique des commandes</td> <td><code>history -50</code></td> </tr> <tr> <th>ls</th> <td><code>ls <i>directory</i></code> </td> <td>Listing du contenu d'un répertoire</td> <td><code>ls Formation</code><br><code>ls Formation/TP1</code></td> </tr> <tr> <th>mkdir</th> <td><code>mkdir <i>dirName</i></code> </td> <td>Création un répertoire (<code>directory</code>)</td> <td><code>mkdir Formation/TP2</code></td> </tr> <tr> <th>more</th> <td><code>more <i>fileName</i></code> </td> <td>Lecture à l'écran de fichiers texte (surtout longs)</td> <td><code>more table.txt</code></td> </tr> <tr> <th>mv</th> <td><code>mv <i>inputFile</i> <i>targetFile</i></code> </td> <td>Déplacement (ou renommage) d'un fichier</td> <td><code>mv table.tmp table.txt</code></td> </tr> <tr> <th>pwd</th> <td><code>pwd</code></td> <td>Affichage du <code>working directory</code></td> <td><code>pwd</code></td> </tr> <tr> <th>rm</th> <td><code>rm <i>path</i></code></td> <td>Effacement d'un fichier</td> <td><code>rm file.txt</code><br><code>rm Formation/TP1/table.tmp</code></td> </tr> <tr> <th>rm</th> <td><code>\rm <i>path</i></code></td> <td>Effacement d'un fichier (en ignorant la confirmation avant chaque destruction)</td> <td><code>\rm file.txt</code></td> </tr> <tr> <th>rm</th> <td><code>rm -r <i>path</i></code></td> <td>Effacement récursif d'un répertoire</td> <td><code>rm -r TP2/*.tmp</code></td> </tr> <tr> <th>rmdir</th> <td><code>rmdir <i>path</i></code></td> <td>Effacement d'un répertoire (il doit être vide)</td> <td><code>rmdir TP3</code></td> </tr> <tr> <th>sort</th> <td><code>sort < ... >...</code> </td> <td>Tri du flot d'entrée</td> <td><code>cat file1.txt file2.txt | sort > file3.txt</code></td> </tr> <tr> <th>tail</th> <td><code>tail [-n] </code> </td> <td>Sélection de la fin d'un fichier (en nombre de lignes)</td> <td><code>tail -1 < table.txt</code></td> </tr> <tr> <th>type</th> <td><code>type <i>command</i></code> </td> <td> Donne le type de la commande (alias, exécutable, etc.) et précise sa nature. </td> <td><code>type ll</code></td> </tr> <tr> <th>wc</th> <td><code>wc [<i>fileName</i>] </code></td> <td> Affichage de la taille d'un fichier (nombre de caractères, de mots, de lignes) </td> <td><code>wc -l < file.xml</code></td> </tr> <tr> <th>which</th> <td><code>which <i>command</i> </code></td> <td>Renvoie le chemin de la commande qui est exécutée quand on tape son nom dans le shell</td> <td><code>which ls</code></td> </tr> </table> </div> <hr> <address><a href="mailto:philippe.houdry@inist.fr">Philippe.Houdry@inist.fr</a></address> </body> </html>