<?xml version="1.0" encoding="UTF-8" ?>
<!-- RSS generated by PHPBoost on Wed, 13 May 2026 10:42:15 +0200 -->

<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Derniers articles - STHDA : Linux]]></title>
		<atom:link href="https://www.sthda.com/french/syndication/rss/articles/22" rel="self" type="application/rss+xml"/>
		<link>https://www.sthda.com</link>
		<description><![CDATA[Derniers articles - STHDA : Linux]]></description>
		<copyright>(C) 2005-2026 PHPBoost</copyright>
		<language>fr</language>
		<generator>PHPBoost</generator>
		
		
		<item>
			<title><![CDATA[Transf?rer des fichiers]]></title>
			<link>https://www.sthda.com/french/articles/22-linux/71-transferer-des-fichiers/</link>
			<guid>https://www.sthda.com/french/articles/22-linux/71-transferer-des-fichiers/</guid>
			<description><![CDATA[L'objectif de cet article est de vous montrer comment t?l?charger, transfert des fichiers, synchroniser deux r?pertoires ? partir de linux.<br />
<br />
<h2 class="formatter-title">wget : t?l?chargement de fichiers</h2><br />
<br />
Il suffit d'indiquer l?adresse HTTP ou FTP d'un fichier ? t?l?charger :<br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><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>www.ubuntu-fr.org<span style="color: #000000; font-weight: bold;">/</span>telechargement?<span style="color: #007800;">action</span>=dl</pre></pre></div><br />
<span class="warning">Pour arr?ter le t?l?chargement : Ctrl + c</span><br />
Pour reprendre un t?l?chargement arr?t?, utiliser l'option -c :<br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #660033;">-c</span> http:<span style="color: #000000; font-weight: bold;">//</span>www.ubuntu-fr.org<span style="color: #000000; font-weight: bold;">/</span>telechargement?<span style="color: #007800;">action</span>=dl</pre></pre></div><br />
<br />
Lancer un t?l?chargement en tache de fond :<br />
- Utiliser la technique <strong>nohup</strong> qui s'applique ? toutes les commandes<br />
- Utiliser l'option --background<br />
<br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #660033;">--background</span> <span style="color: #660033;">-c</span> http:<span style="color: #000000; font-weight: bold;">//</span>www.ubuntu-fr.org<span style="color: #000000; font-weight: bold;">/</span>telechargement?<span style="color: #007800;">action</span>=dl</pre></pre></div><br />
<span class="success">wget propose pas mal d'options. Faire man wget pour voir les options. </span><br />
<br />
<h2 class="formatter-title">scp : copier des fichiers ? travers le r?seau</h2><br />
<br />
scp = secure copy<br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">scp</span> fichier_origine copie_destination</pre></pre></div><br />
<strong><span style="color:#000080;">Copier un fichier de votre ordinateur vers un autre :</span></strong><br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">scp</span> image.png akassambara<span style="color: #000000; font-weight: bold;">@</span>85.123.10.201:~<span style="color: #000000; font-weight: bold;">/</span>images<span style="color: #000000; font-weight: bold;">/</span></pre></pre></div><br />
<span class="success">Remplacer l'IP par le nom d'h?te</span><br />
<br />
<br />
<strong><span style="color:#000080;">Copier plusieurs fichiers de votre ordinateur vers un autre :</span></strong><br />
<br />
- Utiliser l'option -r (recursif) en pr?cisant le dossier : <br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">scp</span> <span style="color: #660033;">-r</span> mon_dossier akassambara<span style="color: #000000; font-weight: bold;">@</span>85.123.10.201:~<span style="color: #000000; font-weight: bold;">/</span>images<span style="color: #000000; font-weight: bold;">/</span></pre></pre></div><br />
<br />
<br />
<strong><span style="color:#000080;">Copier un fichier d'un autre ordinateur vers le v?tre:</span></strong><br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;">&nbsp;
<span style="color: #c20cb9; font-weight: bold;">scp</span> akassambara<span style="color: #000000; font-weight: bold;">@</span>85.123.10.201:image.png copie_image_sur_mon_pc.png
<span style="color: #666666; font-style: italic;">#Copier le fichier sans  changer le nom :</span>
<span style="color: #c20cb9; font-weight: bold;">scp</span> akassambara21<span style="color: #000000; font-weight: bold;">@</span>85.123.10.201:image.png 
&nbsp;</pre></pre></div><br />
<br />
<span class="warning">Si le serveur SSH auquel vous essayez de vous connecter n'est pas sur le port standard (22), il faudra indiquer le num?ro du port avec l'option -P :</span><br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">scp</span> <span style="color: #660033;">-P</span> <span style="color: #000000;">16296</span> akassambara<span style="color: #000000; font-weight: bold;">@</span>85.123.10.201:image.png .</pre></pre></div><br />
<br />
<br />
<h2 class="formatter-title">ftp & sftp : transf?rer des fichiers</h2><br />
Le FTP (File Transfer Protocol) est un protocole permettant d'?changer des fichiers sur le r?seau. La connexion peut se faire en mode anonyme (site public) ou authentifi? (site priv?)<br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;">&nbsp;
<span style="color: #666666; font-style: italic;">#Connexion au serveur debian</span>
<span style="color: #c20cb9; font-weight: bold;">ftp</span> ftp.debian.org
<span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #666666; font-style: italic;">#Afficher le contenu du repertoire </span>
<span style="color: #7a0874; font-weight: bold;">pwd</span> <span style="color: #666666; font-style: italic;">#chemin du r?pertoire actuel</span>
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #666666; font-style: italic;"># Changer de r?pertoire</span>
&nbsp;</pre></pre></div><br />
<br />
<h3 class="formatter-title">Transfert des fichiers</h3><br />
<br />
<strong>put</strong> : envoie un fichier vers le server<br />
<strong>get</strong> : t?l?charge un fichier depuis le serveur.<br />
<br />
Vous pouvez par exemple r?cup?rer le fichier README :<br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ftp</span> get README </pre></pre></div><br />
<br />
Le fichier est t?l?charg? dans le dossier dans lequel vous vous trouviez sur votre ordinateur.<br />
<br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;"> <span style="color: #c20cb9; font-weight: bold;">ftp</span><span style="color: #000000; font-weight: bold;">></span> <span style="color: #000000; font-weight: bold;">!</span><span style="color: #7a0874; font-weight: bold;">pwd</span> <span style="color: #666666; font-style: italic;"># Pour savoir dans quel dossier vous ?tes chez vous</span></pre></pre></div><br />
<br />
<span class="warning">Pour quitter la session : Ctrl + D</span><br />
<br />
<h3 class="formatter-title">sftp : Transfert s?curis?</h3><br />
<br />
Requiert un mot de passe<br />
<br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;">sftp <span style="color: #c20cb9; font-weight: bold;">login</span><span style="color: #000000; font-weight: bold;">@</span><span style="color: #c20cb9; font-weight: bold;">ip</span></pre></pre></div><br />
<br />
<span class="warning"><br />
Si votre serveur SSH fonctionne sur un autre port, vous devrez le pr?ciser comme ceci : sftp -oPort=27401 login@serveur.<br />
</span><br />
<br />
<h2 class="formatter-title">rsync : synchroniser des fichiers pour une sauvegarde</h2><br />
<br />
<strong><span style="color:#333399;">rsync</span></strong> permet d'effectuer une synchronisation entre deux r?pertoires, que ce soit sur le m?me PC ou entre deux ordinateurs reli?s en r?seau.<br />
<br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;">C<span style="color: #ff0000;">'est une sorte de scp intelligent : il compare et analyse les diff?rences entre deux dossiers puis copie uniquement les changements.</span></pre></pre></div><br />
<br />
<h3 class="formatter-title">Synchroniser deux dossiers du m?me ordinateur</h3><br />
<br />
Le contenu du dossier images est sauvegard? dans le dossier backups:<br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;">&nbsp;
rsync <span style="color: #660033;">-arv</span> <span style="color: #660033;">--delete</span> Images<span style="color: #000000; font-weight: bold;">/</span> backups<span style="color: #000000; font-weight: bold;">/</span>
&nbsp;</pre></pre></div><br />
<br />
<span class="success"><br />
    -a : conserve toutes les informations sur les fichiers, comme les droits (chmod), la date de modification, etc. ;<br />
    -r : sauvegarde aussi tous les sous-dossiers qui se trouvent dans le dossier ? sauvegarder ;<br />
    -v : mode verbeux, affiche des informations d?taill?es sur la copie en cours.<br />
    --delete : pour que le contenu soit strictement identique. Lorsqu'un fichier a ?t? supprimer dans le r?pertoire d'origine, il le sera ?galement dans le r?pertoire de sauvegarde.<br />
</span><br />
<br />
<strong><span style="color:#000080;">Pour mettre les fichiers supprimer dans "un dossier corbeille" au cas ou : </span></strong><br />
Ajouter l'option : --backup --backup-dir=~/kass/backups_supprimes<br />
<br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;">&nbsp;
 rsync <span style="color: #660033;">-arv</span> <span style="color: #660033;">--delete</span> <span style="color: #660033;">--backup</span> <span style="color: #660033;">--backup-dir</span>=~<span style="color: #000000; font-weight: bold;">/</span>kass<span style="color: #000000; font-weight: bold;">/</span>backups_supprimes Images<span style="color: #000000; font-weight: bold;">/</span> backups<span style="color: #000000; font-weight: bold;">/</span>
&nbsp;</pre></pre></div><br />
<br />
<span class="warning">Indiquer le chemin absolu du dossier corbeille pour ?viter des probl?mes</span><br />
<br />
<h3 class="formatter-title">Sauvegarder sur un autre ordinateur</h3><br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;">&nbsp;
rsync <span style="color: #660033;">-arv</span> <span style="color: #660033;">--delete</span> <span style="color: #660033;">--backup</span> <span style="color: #660033;">--backup-dir</span>=<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>kassambara<span style="color: #000000; font-weight: bold;">/</span>fichiers_supprimes Images<span style="color: #000000; font-weight: bold;">/</span> mateo21<span style="color: #000000; font-weight: bold;">@</span>IP_du_serveur:mes_backups<span style="color: #000000; font-weight: bold;">/</span>
&nbsp;</pre></pre></div><br />
<br />
Si votre serveur SSH ?coute sur un autre port que celui par d?faut, il faudra rajouter -e "ssh -p port" :<br />
<br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;">&nbsp;
rsync <span style="color: #660033;">-arv</span> <span style="color: #660033;">--delete</span> <span style="color: #660033;">--backup</span> <span style="color: #660033;">--backup-dir</span>=<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>kass<span style="color: #000000; font-weight: bold;">/</span>fichiers_supprimes Images<span style="color: #000000; font-weight: bold;">/</span> kass<span style="color: #000000; font-weight: bold;">@</span>IP_du_serveur:mes_backups<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">"ssh -p 12473"</span>
&nbsp;</pre></pre></div>]]></description>
			<pubDate>Fri, 03 Oct 2014 16:14:00 +0200</pubDate>
			
		</item>
		
		<item>
			<title><![CDATA[Connaitre les capacit?s de l'ordinateur]]></title>
			<link>https://www.sthda.com/french/articles/22-linux/69-connaitre-les-capacites-de-l-ordinateur/</link>
			<guid>https://www.sthda.com/french/articles/22-linux/69-connaitre-les-capacites-de-l-ordinateur/</guid>
			<description><![CDATA[<h2 class="formatter-title">RAM</h2><br />
<br />
La commande free peut ?tre utilis?e pour conna?tre la RAM. Les options -b, -k, -m, -g donnent la m?moire en KB, MB ou GB<br />
<br />
L'option -t affiche la RAM totale+SWAP<br />
<br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;">&nbsp;
<span style="color: #c20cb9; font-weight: bold;">free</span> <span style="color: #660033;">-tg</span>
&nbsp;</pre></pre></div><br />
<br />
<h2 class="formatter-title">Taille des disques</h2><br />
<br />
Utiliser la commande df -h<br />
<br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;">&nbsp;
<span style="color: #c20cb9; font-weight: bold;">df</span> <span style="color: #660033;">-h</span>
&nbsp;</pre></pre></div><br />
<br />
<h2 class="formatter-title">Version de linux</h2><br />
<br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;">&nbsp;
lsb_release <span style="color: #660033;">-a</span>
&nbsp;</pre></pre></div><br />
<br />
<h2 class="formatter-title">32 ou 64 bits</h2><br />
<br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;">&nbsp;
<span style="color: #c20cb9; font-weight: bold;">uname</span> <span style="color: #660033;">-a</span>
&nbsp;</pre></pre></div><br />
<br />
<h2 class="formatter-title">Afficher le nombre de coeurs processeur sous Linux</h2><br />
<br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;">&nbsp;
<span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">'model name'</span> <span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span>cpuinfo <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">wc</span> <span style="color: #660033;">-l</span>
&nbsp;</pre></pre></div>]]></description>
			<pubDate>Wed, 24 Sep 2014 09:51:00 +0200</pubDate>
			
		</item>
		
		<item>
			<title><![CDATA[La console Linux]]></title>
			<link>https://www.sthda.com/french/articles/22-linux/66-la-console-linux/</link>
			<guid>https://www.sthda.com/french/articles/22-linux/66-la-console-linux/</guid>
			<description><![CDATA[[page]La console et les commandes de base[/page]<br />
<!-- START HTML -->
<ul id="toc"></ul>
<!-- END HTML --><br />
<br />
<h3 class="formatter-title">O? se trouve la console</h3><br />
<br />
<strong>Sous KDE</strong> : Rechercher <strong>Konsole</strong> dans le lanceur graphique<br />
<strong>Sous Unity</strong>: Rechercher <strong>Terminal</strong> dans le lanceur graphique<br />
<br />
<span class="notice">Pour acc?der ? distance ? distance ? un ordinateur (ou serveur) sous linux, on utilise le protocole SSH. PuTTY est un logiciel Windows qui permet d'acc?der ? une machine Linux depuis windows via le protocole SSH.</span><br />
<br />
<h3 class="formatter-title">Symboles affich?s sur la console</h3><br />
<br />
$: compte utilisateur normal avec des droits limit?s<br />
#: mode super-utilisateur<br />
<br />
<h3 class="formatter-title">Commandes et param?tres</h3><br />
<br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;">&nbsp;
<span style="color: #c20cb9; font-weight: bold;">date</span> <span style="color: #666666; font-style: italic;">#Affiche la date</span>
<span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #666666; font-style: italic;">#Liste les fichiers et dossiers du r?pertoire actuel </span>
<span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-a</span> <span style="color: #666666; font-style: italic;">#Affiche tout le contenu du dossier, m?me les fichiers cach?s</span>
<span style="color: #c20cb9; font-weight: bold;">ls</span> Examples <span style="color: #666666; font-style: italic;">#Affiche le contenu du dossier Examples</span>
<span style="color: #c20cb9; font-weight: bold;">clear</span> <span style="color: #666666; font-style: italic;">#Efface le contenu de la console</span>
<span style="color: #7a0874; font-weight: bold;">pwd</span> <span style="color: #666666; font-style: italic;">#Affiche le r?pertoire courant</span>
&nbsp;</pre></pre></div><br />
<br />
<h3 class="formatter-title">pwd et which: O? suis-je?</h3><br />
<br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;">&nbsp;
<span style="color: #7a0874; font-weight: bold;">pwd</span> <span style="color: #666666; font-style: italic;">#renvoie le r?pertoire courant</span>
<span style="color: #c20cb9; font-weight: bold;">which</span> mysql <span style="color: #666666; font-style: italic;">#Renvoie l'emplacement du programme mysql (/usr/bin/mysql)</span>
<span style="color: #c20cb9; font-weight: bold;">which</span> <span style="color: #7a0874; font-weight: bold;">pwd</span> <span style="color: #666666; font-style: italic;">#Renvoie l'emplacement de la commande pwd (/bin/pwd)</span>
&nbsp;</pre></pre></div><br />
<br />
<h3 class="formatter-title">Lister les fichiers et dossiers</h3><br />
<br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;">&nbsp;
<span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #666666; font-style: italic;">#Affiche la liste des fichiers et dossier du r?pertoire courant</span>
<span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-a</span> <span style="color: #666666; font-style: italic;">#Afficher tous les fichiers et dossiers cach?s</span>
<span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-F</span> <span style="color: #666666; font-style: italic;">#Rajoute ? la fin des ?l?ments un symbole pour qu'on puisse faire la distinction entre les dossiers, fichiers</span>
<span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-l</span> <span style="color: #666666; font-style: italic;">#Liste d?taill?e (droits, nombre de liens physiques, propri?taire, groupe, taille en octets, date de derni?re modification, nom du fichier ou dossier)</span>
<span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-lh</span> <span style="color: #666666; font-style: italic;">#Liste d?taill?e avec la taille indiqu?e en Ko, Mo, Go. (NB: h=human readable)</span>
<span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-lt</span> <span style="color: #666666; font-style: italic;">#Trier par date de derni?re modification</span>
&nbsp;</pre></pre></div><br />
<br />
<span class="warning">En pratique, il est pr?f?rable de combiner -t avec -r. Ce qui renverse l'ordre d'affichage des fichiers afin d'avoir le dernier fichier modifi? en bas de la liste, c'est plus pratique ? l'usage dans la console.</span><br />
<br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-larth</span> <span style="color: #666666; font-style: italic;">#contient toutes les options que j'aime</span></pre></pre></div><br />
<br />
<h3 class="formatter-title">cd: Changer de dossier</h3><br />
<br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;">&nbsp;
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #666666; font-style: italic;">#Aller ? la racine</span>
<span style="color: #7a0874; font-weight: bold;">cd</span> usr<span style="color: #000000; font-weight: bold;">/</span>games <span style="color: #666666; font-style: italic;">#Aller dans le dossier games</span>
<span style="color: #7a0874; font-weight: bold;">cd</span> .. <span style="color: #666666; font-style: italic;">#Revenir au dossier pr?c?dent (usr)</span>
<span style="color: #7a0874; font-weight: bold;">cd</span> ..<span style="color: #000000; font-weight: bold;">/</span>.. <span style="color: #666666; font-style: italic;">#Permet de reculer de deux dossiers parents</span>
<span style="color: #7a0874; font-weight: bold;">cd</span> ~ <span style="color: #666666; font-style: italic;">#Retour au r?pertoire parent </span>
&nbsp;</pre></pre></div><br />
<br />
<span class="warning">Le nom du dossier peut ?tre automatiquement compl?t? par la console. Taper par exemple : cd /usr/ga puis appuyer sur Tab. La commande est compl?t?e ? cd /usr/games</span><br />
<br />
<h3 class="formatter-title">du: taille occup?e par les dossiers </h3><br />
<br />
<strong>du</strong>: disk usage<br />
<br />
<br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;">&nbsp;
<span style="color: #7a0874; font-weight: bold;">cd</span>  <span style="color: #666666; font-style: italic;">#on se place dans le r?pertoire home</span>
<span style="color: #c20cb9; font-weight: bold;">du</span> <span style="color: #666666; font-style: italic;">#Affiche la taille en octets des dossiers (uniquement) du r?pertoire actuel</span>
<span style="color: #c20cb9; font-weight: bold;">du</span> <span style="color: #660033;">-h</span> <span style="color: #666666; font-style: italic;">#taille pour les humains (en Ko, Mo, Go)</span>
<span style="color: #c20cb9; font-weight: bold;">du</span> <span style="color: #660033;">-a</span> <span style="color: #666666; font-style: italic;">#Affiche la taille des dossiers ET des fichiers</span>
<span style="color: #c20cb9; font-weight: bold;">du</span> <span style="color: #660033;">-sh</span> <span style="color: #666666; font-style: italic;">#Affiche la taille totale occup?e par le dossier actuel.</span>
&nbsp;</pre></pre></div><br />
<br />
[page]Manipuler les fichiers[/page]<br />
<!-- START HTML -->
<ul id="toc"></ul>
<!-- END HTML --><br />
<br />
<h3 class="formatter-title">cat & less : afficher un fichier </h3><br />
<br />
<h4 class="formatter-title">cat : afficher tout le fichier</h4><br />
<br />
Nous allons travailler sur un fichier qui existe d?j? : syslog (dans le dossier /var/log).<br />
<br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;">&nbsp;
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log <span style="color: #666666; font-style: italic;">#on se place dans le dossier log</span>
<span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #666666; font-style: italic;">#affiche le contenu du dossier log</span>
<span style="color: #c20cb9; font-weight: bold;">cat</span> syslog <span style="color: #666666; font-style: italic;">#Affiche tout le contenu du fichier  syslog dans la console d'un coup</span>
<span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #660033;">-n</span> syslog <span style="color: #666666; font-style: italic;">#Affiche le contenu du fichier en indiquant le num?ro de ligne</span>
&nbsp;</pre></pre></div><br />
<br />
<span class="warning">La commande <strong>cat</strong> vous envoie tout le fichier ? la figure. Elle est plus adapt?e lorsque l'on travaille sur de petits fichiers que sur des gros.</span><br />
<br />
<h4 class="formatter-title">less : afficher le fichier page par page</h4><br />
<br />
<strong>less</strong> affiche progressivement le contenu du fichier, page par page<br />
<br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;">&nbsp;
<span style="color: #c20cb9; font-weight: bold;">less</span> syslog
&nbsp;</pre></pre></div><br />
<br />
Pour lire la suite, il y a des raccourcis clavier ? connaitre:<br />
<br />
<ul class="formatter-ul">
<li class="formatter-li">Espace : Affiche la suite du fichier.
</li><li class="formatter-li">Entr?e : Affiche la ligne suivante.Vous pouvez aussi utiliser la fl?che vers le bas.
</li><li class="formatter-li">d : affiche les onze lignes suivantes (soit une moiti? d'?cran).
</li><li class="formatter-li">b : retourne en arri?re d'un ?cran.
</li><li class="formatter-li">y : retourne d'une ligne en arri?re. Vous pouvez aussi appuyer sur la touche Fl?che vers le haut.
</li><li class="formatter-li">u : retourne en arri?re d'une moiti? d'?cran (onze lignes).
</li><li class="formatter-li">q : arr?te la lecture du fichier. Cela met fin ? la commande less.<br />
</li></ul><br />
<br />
<h4 class="formatter-title">Quelques raccourcis plus avanc?s</h4><br />
<br />
<ul class="formatter-ul">
<li class="formatter-li">= : indique o? vous en ?tes dans le fichier (num?ro des lignes affich?es et pourcentage).
</li><li class="formatter-li">h : affiche l'aide (toutes les commandes que je vous apprends ici, je les tire de l?). Tapez q pour sortir de l'aide.
</li><li class="formatter-li">/ : tapez / suivi du texte que vous recherchez pour lancer le mode recherche. Faites Entr?e pour valider. Pour ceux qui savent s'en servir, sachez que les expressions r?guli?res sont accept?es.
</li><li class="formatter-li">n : apr?s avoir fait une recherche avec /, la touche n vous permet d'aller ? la prochaine occurrence de votre recherche.
</li><li class="formatter-li">N : pareil que n, mais pour revenir en arri?re.<br />
</li></ul><br />
<br />
<h3 class="formatter-title">head & tail : afficher le d?but et la fin d'un fichier </h3><br />
<br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;">&nbsp;
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log <span style="color: #666666; font-style: italic;">#on se place dans le dossier log</span>
<span style="color: #c20cb9; font-weight: bold;">head</span> syslog <span style="color: #666666; font-style: italic;">#Affiche juste les premi?res lignes du fichier. Ne permet pas de se d?placer dans le fichier comme less</span>
<span style="color: #c20cb9; font-weight: bold;">head</span> <span style="color: #660033;">-n</span> <span style="color: #000000;">3</span> syslog <span style="color: #666666; font-style: italic;">#Affiche les 3 premi?res lignes du fichier</span>
<span style="color: #c20cb9; font-weight: bold;">tail</span> syslog <span style="color: #666666; font-style: italic;">#affiche les derni?res lignes du fichier</span>
<span style="color: #c20cb9; font-weight: bold;">tail</span> <span style="color: #660033;">-n</span> <span style="color: #000000;">3</span> <span style="color: #666666; font-style: italic;">#Affiche les 3 derni?res lignes du fichier</span>
&nbsp;</pre></pre></div><br />
<br />
<span class="warning">Il y a un autre param?tre pour tail: -f (f pour follow). Ce param?tre ordonne ? tail de ? suivre ? la fin du fichier au fur et ? mesure de son ?volution. C'est un bon moyen de surveiller ce qui se passe en temps r?el sur un ordinateur. </span><br />
<br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">tail</span> <span style="color: #660033;">-f</span> syslog</pre></pre></div><br />
<br />
<span class="success">Faites Ctrl + C (Ctrl et C en m?me temps) pour arr?ter la commande tail.</span><br />
<br />
Par exemple, les logs Apache du Site permettent de voir en temps r?el qui se connecte sur le site, avec quelle IP, quel fichier a ?t? charg?, ? quelle heure, etc.<br />
<br />
<span class="notice">Notez que par d?faut, tail -f recherche les nouveaux changements dans le fichier toutes les secondes. Si vous voulez, vous pouvez rajouter le param?tre -s suivi d'un nombre. Par exemple, tail -f -s 3 syslog recherchera les changements toutes les trois secondes (plut?t que toutes les secondes).</span><br />
<br />
<h3 class="formatter-title">touch & mkdir : cr?er des fichiers et dossiers </h3><br />
<br />
La commande touch est ? la base faite pour modifier la date de derni?re modification d'un fichier. Si le fichier n'existe pas, il sera cr??.<br />
<br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;">&nbsp;
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #666666; font-style: italic;"># on se place dans le home</span>
<span style="color: #c20cb9; font-weight: bold;">touch</span> fichier1.txt <span style="color: #666666; font-style: italic;"># cr?ation du fichier 1</span>
<span style="color: #c20cb9; font-weight: bold;">touch</span> fichier1.txt fichier2.txt <span style="color: #666666; font-style: italic;">#Cr?ation de deux fichiers en m?me temps</span>
<span style="color: #c20cb9; font-weight: bold;">touch</span> <span style="color: #ff0000;">"mon fichier.txt"</span> <span style="color: #666666; font-style: italic;"># le nom du fichier contient des espaces</span>
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> dossier1.txt <span style="color: #666666; font-style: italic;">#cr?ation du dossier</span>
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> dossier1.txt dossier2.txt <span style="color: #666666; font-style: italic;">#Cr?ation de deux dossiers en m?me temps</span>
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> animaux<span style="color: #000000; font-weight: bold;">/</span>vertebres<span style="color: #000000; font-weight: bold;">/</span>chat <span style="color: #666666; font-style: italic;"># Le param?tre -p sert ? cr?er des dossiers interm?diaires (animaux puis vertebres dans animaux, puis chat dans vertebres). </span>
&nbsp;</pre></pre></div><br />
<br />
<h3 class="formatter-title">cp & mv : copier et d?placer un fichier </h3><br />
<br />
<h4 class="formatter-title">cp: copier des fichiers</h4><br />
<br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;">&nbsp;
<span style="color: #666666; font-style: italic;">#copier dans le m?me dossier</span>
<span style="color: #c20cb9; font-weight: bold;">cp</span> fichier1.txt fichier1_copie.txt <span style="color: #666666; font-style: italic;"># param?tre 1: nom du fichier ? copier; param?tre 2: nom de la copie</span>
<span style="color: #666666; font-style: italic;">#copier dans un autre dossier</span>
<span style="color: #c20cb9; font-weight: bold;">cp</span> fichier1.txt mondossier<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #666666; font-style: italic;">#fichier1.txt est copier vers "mondossier" sous le m?me nom</span>
<span style="color: #c20cb9; font-weight: bold;">cp</span> fichier1.txt mondossier<span style="color: #000000; font-weight: bold;">/</span>fichier2.txt <span style="color: #666666; font-style: italic;"># fichier1.txt est copier vers "mondossier" sous le nom fichier2.txt</span>
&nbsp;</pre></pre></div><br />
<br />
<h4 class="formatter-title">Copier des dossiers</h4><br />
<br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;">&nbsp;
<span style="color: #666666; font-style: italic;">#Avec l'option -R, vous pouvez copier un dossier, ainsi que tous les sous-dossiers et fichiers qu'il contient !</span>
<span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #660033;">-R</span> dossier1 dossier2 <span style="color: #666666; font-style: italic;">#dossier1 est copi? sous le nom dossier2</span>
&nbsp;</pre></pre></div><br />
<br />
<h4 class="formatter-title">Utiliser le joker</h4><br />
<br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;">&nbsp;
<span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #000000; font-weight: bold;">*</span>.jpg mondossier<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #666666; font-style: italic;"># Copier tous les fichiers image .jpg dans un sous-dossier</span>
<span style="color: #c20cb9; font-weight: bold;">cp</span> so<span style="color: #000000; font-weight: bold;">*</span> mondossier<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #666666; font-style: italic;">#Copier tous les fichiers dont le nom commence par ? so ?</span>
&nbsp;</pre></pre></div><br />
<br />
<br />
<h4 class="formatter-title">mv: Renommer/D?placer un fichier</h4><br />
<br />
<span class="success">mv s'utilise pratiquement comme cp et permet de d?placer ou de renommer un fichier/dossier</span><br />
<br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;">&nbsp;
<span style="color: #c20cb9; font-weight: bold;">mv</span> fichier1.txt fichier2.txt <span style="color: #666666; font-style: italic;">#renommer un fichier</span>
<span style="color: #c20cb9; font-weight: bold;">mv</span> fichier1.txt mondossier<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #666666; font-style: italic;">#fichier1.txt est d?placer vers un sous-dossier</span>
<span style="color: #c20cb9; font-weight: bold;">mv</span> fichier1.txt mondossier<span style="color: #000000; font-weight: bold;">/</span>fichier2.txt <span style="color: #666666; font-style: italic;"># fichier1.txt est d?placer dans le sous-dossier avec changement de nom</span>
<span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #000000; font-weight: bold;">*</span>.jpg mondossier<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #666666; font-style: italic;">#d?place tous les fichiers image .jpg dans un sous-dossier</span>
&nbsp;</pre></pre></div><br />
<br />
<h4 class="formatter-title">rm : supprimer des fichiers et dossiers</h4><br />
<br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;">&nbsp;
<span style="color: #c20cb9; font-weight: bold;">rm</span> fichier1.txt <span style="color: #666666; font-style: italic;"># supprime le fichier</span>
<span style="color: #c20cb9; font-weight: bold;">rm</span> fichier1.txt fichier2.txt <span style="color: #666666; font-style: italic;"># supprime plusieurs fichiers en m?me temps</span>
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-i</span> fichier1.txt <span style="color: #666666; font-style: italic;"># Demande une confirmation lors de la suppression</span>
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-f</span> fichier1.txt <span style="color: #666666; font-style: italic;"># Force la suppression quoi qu'il arrive</span>
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-v</span> fichier1.txt <span style="color: #666666; font-style: italic;"># Verbose (parle beaucoup), montre l'avancement</span>
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-r</span> dossier<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #666666; font-style: italic;">#supprime un dossier et son contenu</span>
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-rf</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #666666; font-style: italic;">#supprime tous les fichiers et sous-dossiers du dossier dans lequel je me trouve</span>
&nbsp;</pre></pre></div><br />
<br />
<br />
<h3 class="formatter-title">ln -s : Cr?er des liens symboliques entre fichiers</h3><br />
<br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;">&nbsp;
<span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> fichier1.txt fichier2.txt <span style="color: #666666; font-style: italic;">#fichier 2 repr?sente un raccourci de fichier 1</span>
&nbsp;</pre></pre></div><br />
<br />
[page]Les utilisateurs et les droits [/page]<br />
<br />
<h4 class="formatter-title">sudo: ex?cuter une commande en root </h4><br />
<br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;">&nbsp;
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #666666; font-style: italic;">#ex?cuter une commande en tant que root</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">su</span> <span style="color: #666666; font-style: italic;">#devenir root et le rester</span>
&nbsp;</pre></pre></div><br />
<br />
<span class="success">Pour quitter le ? mode root ?, tapez exit (ou faites la combinaison Ctrl + D).</span><br />
<br />
<h3 class="formatter-title">adduser : gestion des utilisateurs</h3><br />
<br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;">&nbsp;
adduser patrick <span style="color: #666666; font-style: italic;">#ajout de l'utilisateur patrick; le mot de pass vous sera demand?</span>
<span style="color: #c20cb9; font-weight: bold;">passwd</span> patrick <span style="color: #666666; font-style: italic;">#changer le mot de passe de patrick</span>
deluser patrick <span style="color: #666666; font-style: italic;">#supprime l'utilisateur patrick sans confirmation</span>
deluser <span style="color: #660033;">--remove-home</span> patrick<span style="color: #666666; font-style: italic;"># supprime le repertoire personnel de patrick</span>
&nbsp;</pre></pre></div><br />
<br />
<h3 class="formatter-title">addgroup : gestion des groupes </h3><br />
<br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;">&nbsp;
addgroup amis <span style="color: #666666; font-style: italic;">#ajouter un groupe d'utilisateur</span>
usermod <span style="color: #660033;">-g</span> amis patrick <span style="color: #666666; font-style: italic;">#ajouter patrick dans le groupe amis</span>
usermod <span style="color: #660033;">-g</span> patrick patrick <span style="color: #666666; font-style: italic;">#remettre patrick dans le groupe patrick comme il l'?tait avant</span>
delgroup amis <span style="color: #666666; font-style: italic;"># supprime le groupe amis</span>
&nbsp;</pre></pre></div><br />
<br />
<span class="warning"><br />
Il est aussi possible de faire en sorte qu'un utilisateur appartienne ? plusieurs groupes. Pour ce faire, utilisez le param?tre -G (majuscule).<br />
Exemple : usermod -G amis,paris,collegues patrick.<br />
S?parez les noms des groupes par une virgule, sans espace entre chaque nom de groupe.<br />
</span><br />
<br />
<span class="error"><br />
Faites tr?s attention en utilisant usermod ! Lorsque vous avez recours ? -G, l'utilisateur change de groupe et ce peu importe les groupes auxquels il appartenait auparavant.<br />
Si vous voulez ajouter des groupes ? un utilisateur (sans perdre les groupes auxquels il appartenait avant cela), utilisez -a :<br />
usermod -aG amis patrick<br />
</span><br />
<br />
<span class="success">addgroup et delgroup n'existent que sous Debian et ses d?riv?s (m?me remarque que pour adduser et deluser).<br />
Les commandes ? traditionnelles ? qui fonctionnent partout sont groupadd et groupdel, mais elles offrent moins d'options.</span><br />
<br />
<h3 class="formatter-title">chown: gestion des propri?taires d'un fichier </h3><br />
<br />
Commande utilis?e en tant que root<br />
<br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;">&nbsp;
<span style="color: #c20cb9; font-weight: bold;">chown</span> patrick rapport.txt <span style="color: #666666; font-style: italic;">#patrick devient le propri?taire du fichier</span>
<span style="color: #c20cb9; font-weight: bold;">chgrp</span> amis rapport.txt <span style="color: #666666; font-style: italic;">#changer le groupe propri?taire d'un fichier</span>
<span style="color: #666666; font-style: italic;">#chown peut aussi changer le groupe propri?taire d'un fichier</span>
<span style="color: #c20cb9; font-weight: bold;">chown</span> patrick:amis rapport.txt <span style="color: #666666; font-style: italic;">#Cela affectera le fichier ? l'utilisateur patrick et au groupe amis.</span>
<span style="color: #666666; font-style: italic;">#-R : affecter r?cursivement les sous-dossiers</span>
<span style="color: #666666; font-style: italic;">#donner tout le contenu du dossier personnel de patrick ? mateo21 (et au groupe mateo21)</span>
<span style="color: #c20cb9; font-weight: bold;">chown</span> <span style="color: #660033;">-R</span> mateo21:mateo21 <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>patrick<span style="color: #000000; font-weight: bold;">/</span>
&nbsp;</pre></pre></div><br />
<br />
<h3 class="formatter-title">chmod : modifier les droits d'acc?s </h3><br />
<br />
<h4 class="formatter-title">Le fonctionnement des droits</h4><br />
<br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;">&nbsp;
<span style="color: #666666;">mateo21@mateo21-desktop:~$ </span><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-l</span>
total <span style="color: #000000;">40</span>
drwxr-xr-x <span style="color: #000000;">2</span> mateo21 mateo21 <span style="color: #000000;">4096</span> <span style="color: #000000;">2007</span>-<span style="color: #000000;">11</span>-<span style="color: #000000;">13</span> <span style="color: #000000;">21</span>:<span style="color: #000000;">53</span> Desktop
drwxr-xr-x <span style="color: #000000;">2</span> mateo21 mateo21 <span style="color: #000000;">4096</span> <span style="color: #000000;">2007</span>-<span style="color: #000000;">11</span>-<span style="color: #000000;">13</span> <span style="color: #000000;">13</span>:<span style="color: #000000;">46</span> Documents
&nbsp;</pre></pre></div><br />
<br />
On peut voir cinq lettres diff?rentes. Voici leur signification :<br />
<br />
    <strong>d</strong> (Directory) : indique si l'?l?ment est un dossier ;<br />
   <strong> l</strong> (Link) : indique si l'?l?ment est un lien (raccourci) ;<br />
   <strong> r </strong>(Read) : indique si on peut lire l'?l?ment ;<br />
    <strong>w </strong>(Write) : indique si on peut modifier l'?l?ment ;<br />
    <strong>x </strong>(eXecute) : si c'est un fichier, ? x ? indique qu'on peut l'ex?cuter. Ce n'est utile que pour les fichiers ex?cutables (programmes et scripts).<br />
  <br />
Si la lettre appara?t, c'est que le droit existe. S'il y a un tiret ? la place, c'est qu'il n'y a aucun droit.<br />
<br />
Les droits sont d?coup?s en fonction des utilisateurs:<br />
 <img src="https://www.sthda.com/french/french/upload/droit_linux.png" alt="" /><br />
<br />
<ul class="formatter-ul">
<li class="formatter-li">le premier triplet rwx indique les droits que poss?de le propri?taire du fichier sur ce dernier ;
</li><li class="formatter-li">le second triplet rwx indique les droits que poss?dent les autres membres du groupe sur ce fichier ;
</li><li class="formatter-li">enfin, le dernier triplet rwx indique les droits que poss?dent tous les autres utilisateurs de la machine sur le fichier.<br />
</li></ul><br />
<br />
<h4 class="formatter-title">chmod : modifier les droits d'acc?s</h4><br />
    <br />
<strong>Attribuer des droits avec des chiffres (chmod absolu)</strong><br />
<br />
<table class="formatter-table">
<tr class="formatter-table-row">
<th class="formatter-table-head">Droit</th>
                <th class="formatter-table-head">Chiffre</th>
</tr>
<tr class="formatter-table-row">
<td class="formatter-table-col">r</td>
<td class="formatter-table-col">4</td>
</tr>
<tr class="formatter-table-row">
<td class="formatter-table-col">w</td>
<td class="formatter-table-col">2</td>
</tr>
<tr class="formatter-table-row">
<td class="formatter-table-col">x</td>
<td class="formatter-table-col">1</td>
</tr>
</table><br />
<br />
Si vous voulez combiner ces droits, il va falloir additionner les chiffres correspondants.<br />
<br />
Voici la liste des droits possibles et la valeur correspondante :<br />
<br />
<!-- START HTML -->

<table >
<thead>
<tr>
<th>
<p>Droits</p>
</th>
<th>
<p>Chiffre</p>
</th>
<th>
<p>Calcul</p>
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p>---</p>
</td>
<td>
<p>0</p>
</td>
<td>
<p>0 + 0 + 0</p>
</td>
</tr>
<tr>
<td>
<p>r--</p>
</td>
<td>
<p>4</p>
</td>
<td>
<p>4 + 0 + 0</p>
</td>
</tr>
<tr>
<td>
<p>-w-</p>
</td>
<td>
<p>2</p>
</td>
<td>
<p>0 + 2 + 0</p>
</td>
</tr>
<tr>
<td>
<p>--x</p>
</td>
<td>
<p>1</p>
</td>
<td>
<p>0 + 0 + 1</p>
</td>
</tr>
<tr>
<td>
<p>rw-</p>
</td>
<td>
<p>6</p>
</td>
<td>
<p>4 + 2 + 0</p>
</td>
</tr>
<tr>
<td>
<p>-wx</p>
</td>
<td>
<p>3</p>
</td>
<td>
<p>0 + 2 + 1</p>
</td>
</tr>
<tr>
<td>
<p>r-x</p>
</td>
<td>
<p>5</p>
</td>
<td>
<p>4 + 0 + 1</p>
</td>
</tr>
<tr>
<td>
<p>rwx</p>
</td>
<td>
<p>7</p>
</td>
<td>
<p>4 + 2 + 1</p>
</td>
</tr>
</tbody>
</table>

<!-- END HTML --><br />
<br />
Par exemple, ? 640 ? indique les droits du propri?taire, du groupe et des autres (dans l'ordre).<br />
<br />
    6 : droit de lecture et d'?criture pour le propri?taire.<br />
    4 : droit de lecture pour le groupe.<br />
    0 : aucun droit pour les autres.<br />
<br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;">&nbsp;
<span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">600</span> rapport.txt
&nbsp;</pre></pre></div><br />
<br />
<strong>Attribuer des droits avec des lettres (chmod relatif)</strong><br />
<br />
Dans ce mode, il faut savoir que :<br />
    <strong>u</strong> = user (propri?taire) ;<br />
    <strong>g</strong> = group (groupe) ;<br />
    <strong>o</strong> = other (autres).<br />
<br />
 et que :<br />
<br />
    + signifie : ? Ajouter le droit ? ;<br />
    - signifie : ? Supprimer le droit ? ;<br />
    = signifie : ? Affecter le droit ?.<br />
<br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;">&nbsp;
<span style="color: #c20cb9; font-weight: bold;">chmod</span> g+<span style="color: #c20cb9; font-weight: bold;">w</span> rapport.txt <span style="color: #666666; font-style: italic;"># Ajouter le droit d'?criture au groupe</span>
<span style="color: #c20cb9; font-weight: bold;">chmod</span> o-r rapport.txt <span style="color: #666666; font-style: italic;">#Enlever le droit de lecture aux autres</span>
<span style="color: #c20cb9; font-weight: bold;">chmod</span> g+<span style="color: #c20cb9; font-weight: bold;">w</span>,o-w rapport.txt <span style="color: #666666; font-style: italic;">#Ajouter le droit d'?criture au groupe et l'enlever aux autres</span>
<span style="color: #c20cb9; font-weight: bold;">chmod</span> go-r rapport.txt <span style="color: #666666; font-style: italic;">#Enlever le droit de lecture au groupe et aux autres </span>
<span style="color: #c20cb9; font-weight: bold;">chmod</span> +x rapport.txt <span style="color: #666666; font-style: italic;">#Ajouter le droit d'ex?cution ? tout le monde</span>
<span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #007800;">u</span>=rwx,<span style="color: #007800;">g</span>=r,<span style="color: #007800;">o</span>=- rapport.txt <span style="color: #666666; font-style: italic;">#Affecter tous les droits au propri?taire, juste la lecture au groupe, rien aux autres</span>
&nbsp;</pre></pre></div><br />
<br />
<strong>Et toujours? -R pour affecter r?cursivement</strong><br />
<br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;">&nbsp;
<span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #660033;">-R</span> <span style="color: #000000;">700</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>mateo21
&nbsp;</pre></pre></div><br />
<br />
[page]Nano, ?diteur de texte du d?butant[/page]<br />
<!-- START HTML -->
<ul id="toc"></ul>
<!-- END HTML --><br />
<br />
<h3 class="formatter-title">Demarrage</h3><br />
<br />
Pour d?marrer le logiciel, il vous suffit simplement de taper nano dans la console :<br />
<br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">nano</span></pre></pre></div><br />
<br />
D?s lors, vous pouvez commencer ? taper du texte.<br />
<br />
Voici les raccourcis les plus importants :<br />
    Ctrl + G : afficher l'aide ;<br />
    Ctrl + K : couper la ligne de texte (et la mettre dans le presse-papier) ;<br />
    Ctrl + U : coller la ligne de texte que vous venez de couper ;<br />
    Ctrl + C : afficher ? quel endroit du fichier votre curseur est positionn? (num?ro de ligne?) ;<br />
    Ctrl + W : rechercher dans le fichier ;<br />
    Ctrl + O : enregistrer le fichier (?crire) ;<br />
    Ctrl + X : quitter Nano.<br />
<br />
<h3 class="formatter-title">Les param?tres de la commande Nano</h3><br />
<br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;">&nbsp;
<span style="color: #c20cb9; font-weight: bold;">nano</span> salut.txt <span style="color: #666666; font-style: italic;">#ouvre le fichier</span>
&nbsp;</pre></pre></div><br />
<br />
<ul class="formatter-ul">
<li class="formatter-li"><strong>-m</strong>: autorise l'utilisation de la souris sous Nano.
</li><li class="formatter-li"><strong>-i</strong>: indentation automatique. L'alin?a (tabulations) de la ligne pr?c?dente sera respect? lorsque vous irez ? la ligne. Tr?s utile lorsque vous ?ditez un fichier de code source.
</li><li class="formatter-li"><strong>-A</strong>: active le retour intelligent au d?but de la ligne.<br />
</li></ul><br />
<br />
Lancer <strong>nano</strong> avec toutes les options:<br />
<br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">nano</span> <span style="color: #660033;">-miA</span> salut.txt</pre></pre></div><br />
<br />
<h3 class="formatter-title">Configurer nano avec .nanorc</h3><br />
<br />
Chaque utilisateur de la machine peut cr?er son propre fichier de configuration .nanorc dans son r?pertoire personnel (home) : /home/personnel/.nanorc. <br />
<br />
<span class="notice">Les fichiers commen?ant par un point sont des fichiers de configuration. Ils sont cach?s. Pour les afficher, il faut utiliser la commande ls -a.</span><br />
<br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;">&nbsp;
<span style="color: #c20cb9; font-weight: bold;">nano</span> .nanorc <span style="color: #666666; font-style: italic;"># cr?ation du fichier</span>
<span style="color: #000000; font-weight: bold;">set</span> mouse <span style="color: #666666; font-style: italic;">#Activation de la souris</span>
<span style="color: #000000; font-weight: bold;">set</span> autoindent <span style="color: #666666; font-style: italic;">#Pour ?viter d'avoir ? taper -i. Indentation automatique.</span>
<span style="color: #000000; font-weight: bold;">set</span> smarthome <span style="color: #666666; font-style: italic;">#Pour ?viter d'avoir ? taper -A. Retour ? la ligne intelligent</span>
&nbsp;</pre></pre></div><br />
<br />
<h3 class="formatter-title">Le nanorc global et la coloration syntaxique</h3><br />
<br />
Il existe un fichier nanorc <strong>global</strong> qui est pris en compte pour tous les utilisateurs: /etc/nanorc. Il contient toutes les options disponibles, mais elles sont pr?c?d?es d'un # qui signifie qu'il s'agit d'un commentaire. Il sufit de decommenter les options d'int?r?ts.<br />
<br />
Vers la fin du fichier, vous verrez une section appel?e  <strong>color setup</strong>, qui commence par ces lignes-l? :<br />
<br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;">&nbsp;
<span style="color: #666666; font-style: italic;">## Nanorc files</span>
<span style="color: #666666; font-style: italic;"># include "/usr/share/nano/nanorc.nanorc"</span>
<span style="color: #666666; font-style: italic;">## C/C++</span>
<span style="color: #666666; font-style: italic;"># include "/usr/share/nano/c.nanorc"</span>
<span style="color: #666666; font-style: italic;">## HTML</span>
<span style="color: #666666; font-style: italic;"># include "/usr/share/nano/html.nanorc"</span>
&nbsp;</pre></pre></div><br />
<br />
Je vous invite ? d?commenter toutes les lignes d'include. Cela permettra d'activer la coloration ? intelligente ? de vos fichiers selon leur type.<br />
<br />
[page]Installer des programmes avec apt-get [/page]<br />
<!-- START HTML -->
<ul id="toc"></ul>
<!-- END HTML --><br />
<br />
Sous linux, les programmes sont regroup?s sur des serveurs appel?s d?pots.<br />
<br />
Le fichier ? ouvrir qui contient la liste des d?p?ts:<br />
<br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">nano</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>apt<span style="color: #000000; font-weight: bold;">/</span>sources.list</pre></pre></div><br />
<br />
Il existe des outils graphiques pour ?diters les sources de d?pots:<br />
Ubuntu : allez dans Syst?me &#8594; Administration &#8594; Sources de logiciels ;<br />
KUbuntu : allez dans Menu K &#8594; Syst?me &#8594; Gestionnaire Adept &#8594; Adept &#8594; G?rer les d?p?ts ;<br />
<br />
<strong>Nous devons g?n?ralement suivre trois ?tapes pour t?l?charger un paquet :</strong><br />
<br />
   <span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;">&nbsp;
<span style="color: #666666; font-style: italic;">#Installation</span>
<span style="color: #c20cb9; font-weight: bold;">apt-get update</span> <span style="color: #666666; font-style: italic;">#(optionnel) : pour mettre notre cache ? jour si ce n'est pas d?j? fait ;</span>
<span style="color: #c20cb9; font-weight: bold;">apt-cache search</span> monpaquet <span style="color: #666666; font-style: italic;">#(optionnel) : pour rechercher le paquet que nous voulons t?l?charger si nous ne connaissons pas son nom exact ;</span>
<span style="color: #c20cb9; font-weight: bold;">apt-get install</span> monpaquet <span style="color: #666666; font-style: italic;"># pour t?l?charger et installer notre paquet.</span>
<span style="color: #666666; font-style: italic;">#d?sinstallation</span>
<span style="color: #c20cb9; font-weight: bold;">apt-get remove</span> monpaquet <span style="color: #666666; font-style: italic;">#desinstalle un paquet</span>
<span style="color: #c20cb9; font-weight: bold;">apt-get autoremove</span>  monpaquet <span style="color: #666666; font-style: italic;">#desinstalle mon paquet ainsi que les d?pendances devenues inutiles.</span>
<span style="color: #666666; font-style: italic;">#mise ? jour</span>
<span style="color: #c20cb9; font-weight: bold;">apt-get upgrade</span> <span style="color: #666666; font-style: italic;">#met ? jour tous les paquets install?s</span>
&nbsp;</pre></pre></div><br />
<br />
<br />
<span class="notice">Les commandes pr?c?dentes doivent ?tre utilis?es en tant que root.</span><br />
<br />
<span class="success"><br />
Astuce : vous pouvez installer plusieurs paquets d'un coup en les listant un ? un :<br />
apt-get install paquet1 paquet2 paquet3<br />
</span><br />
<br />
[page]Manuel d'une commande[/page]<br />
<br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;">&nbsp;
<span style="color: #c20cb9; font-weight: bold;">man</span> <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #666666; font-style: italic;">#Affiche le manuel d'une commande</span>
<span style="color: #c20cb9; font-weight: bold;">apropos</span> sound <span style="color: #666666; font-style: italic;">#Rechercher toutes les commandes qui parlent de son</span>
&nbsp;</pre></pre></div><br />
<br />
[page]Rechercher des fichiers[/page]<br />
<br />
La commande <strong>locate</strong> fait une recherche rapide dans la base de donn?es des fichiers. <br />
<br />
<span class="formatter-code">Code BASH :</span><div class="code"><pre style="display:inline;"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">locate</span> monfichier.txt <span style="color: #666666; font-style: italic;">#recherche rapide</span></pre></pre></div><br />
<br />
<span class="notice">La base de donn?es est mise ? jour par le syst?me une fois par jour. Pour que la recherche tienne compte d'un fichier qui vient d'?tre cr??, il faut mettre ? jour le syst?me en utilisant la commande: sudo updatedb</span><br />
<br />
La commande <strong>find</strong> fait une recherche approfondie des fichiers actuellement pr?sents sur le disque dur.<br />
<br />
<strong>Fonctionnement de la commande find</strong><br />
<br />
find ? o? ? ? quoi ? ? que faire avec ?<br />
<br />
<ul class="formatter-ul">
<li class="formatter-li"> <strong>O?</strong> : c'est le nom du dossier dans lequel la commande va faire la recherche. Par d?faut, si ce param?tre n'est pas pr?cis?, la recherche s'effectuera dans le dossier courant et ses sous-dossiers.
</li><li class="formatter-li"><strong>Quoi </strong>: c'est le fichier ? rechercher. On peut rechercher un fichier par son nom, mais aussi en fonction de la date de sa cr?ation, de sa taille, etc. Ce param?tre est obligatoire.
</li><li class="formatter-li"> <strong>Que faire avec </strong>: il est possible d'effectuer des actions automatiquement sur chacun des fichiers trouv?s. L'action la plus courante consiste ? afficher simplement la liste des fichiers trouv?s, mais nous verrons que nous pouvons faire bien d'autres choses.  Par d?faut, la commande find affiche les r?sultats trouv?s et ne fait rien d'autre avec.<br />
</li></ul>]]></description>
			<pubDate>Sun, 16 Feb 2014 09:12:00 +0100</pubDate>
			
		</item>
		
	</channel>
</rss>
