Newer
Older
cours-unix-shell / UnixShell_cours2018 / commandesBase.fre.html
<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&eacute;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&eacute;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 &lt; ... &gt;...</pre> </td>
	<td>Concat&eacute;nation de fichiers</td>
	<td><code>cat file1.txt file2.txt &gt; 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">&agrave; utiliser avec mod&eacute;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&egrave;me</td>
	<td><code>date</code></td>
	</tr>

	<tr>
	<th>grep</th>
	<td><code>grep <i>expr</i> &lt;... </code> </td>
	<td>S&eacute;lection des lignes contenant l'expression indiqu&eacute;e</td>
	<td><code>grep "&lt;dc:creator&gt;" &lt; file.xml</code></td>
	</tr>

	<tr>
	<th>head</th>
        <td><code>head [-n] </code> </td>
	<td>S&eacute;lection du d&eacute;but d'un fichier (en nombre de lignes)</td>
	<td><code>head -1 &lt; 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&eacute;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&eacute;ation un r&eacute;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 &agrave; l'&eacute;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&eacute;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&eacute;cursif d'un r&eacute;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&eacute;pertoire (il doit &ecirc;tre vide)</td>
	<td><code>rmdir TP3</code></td>
	</tr>

	<tr>
	<th>sort</th>
	<td><code>sort  &lt; ... &gt;...</code> </td>
	<td>Tri du flot d'entr&eacute;e</td>
	<td><code>cat file1.txt file2.txt | sort &gt; file3.txt</code></td>
	</tr>

	<tr>
	<th>tail</th>
	<td><code>tail [-n] </code> </td>
	<td>S&eacute;lection de la fin d'un fichier (en nombre de lignes)</td>
	<td><code>tail -1 &lt; 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&eacute;cutable, etc.) et
	    pr&eacute;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&egrave;res, de mots, de lignes)
	</td>
	<td><code>wc -l &lt; 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&eacute;cut&eacute;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>