Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Prochaine révision
Révision précédente
elearning:workbooks:debian:10:utilisateur:l105 [2022/05/17 08:00] – created adminelearning:workbooks:debian:10:utilisateur:l105 [2024/03/11 09:37] (Version actuelle) admin
Ligne 1: Ligne 1:
 ~~PDF:LANDSCAPE~~ ~~PDF:LANDSCAPE~~
  
-Version : **2022.01**+Version : **2024.01**
  
 Dernière mise-à-jour : ~~LASTMOD~~ Dernière mise-à-jour : ~~LASTMOD~~
  
-====== LCF405 - La Ligne de Commande======+====== LDF405 - La Ligne de Commande======
  
 =====Contenu du Module===== =====Contenu du Module=====
  
-  * **LCF405 - La Ligne de Commande**+  * **LDF405 - La Ligne de Commande**
     * Contenu du Module     * Contenu du Module
     * Le Shell     * Le Shell
Ligne 72: Ligne 72:
         * case         * case
           * Exemple           * Exemple
-        * Boucles +      2.8 - Boucles 
-          * for +        * for 
-          * while +        * while 
-          * Exemple +        * Exemple 
-      * 2.- Scripts de Démarrage +      * 2.- Scripts de Démarrage 
-        * ~/.bash_profile+        * ~/.profile
         * ~/.bashrc         * ~/.bashrc
  
Ligne 94: Ligne 94:
 | bash | Bourne Again Shell | 1987 | Brian Fox | bash | Le shell par défaut de Linux et de MacOS X. Sous RHEL/CentOS 8 : /usr/bin/bash | | bash | Bourne Again Shell | 1987 | Brian Fox | bash | Le shell par défaut de Linux et de MacOS X. Sous RHEL/CentOS 8 : /usr/bin/bash |
 | zsh | Z Shell | 1990 | Paul Falstad | zsh | Zsh est plutôt orienté pour l'interactivité avec l'utilisateur. Sous RHEL/CentOS 8 : /usr/bin/zsh | | zsh | Z Shell | 1990 | Paul Falstad | zsh | Zsh est plutôt orienté pour l'interactivité avec l'utilisateur. Sous RHEL/CentOS 8 : /usr/bin/zsh |
- 
-Sous RHEL/CentOS 8 le shell **/bin/sh** est un lien symbolique vers **/bin/bash** : 
- 
-<code> 
-[trainee@centos8 ~]$ ls -l /bin/sh 
-lrwxrwxrwx. 1 root root 4 Jul 21  2020 /bin/sh -> bash 
-</code> 
  
 =====LAB #1 - Le Shell /bin/bash===== =====LAB #1 - Le Shell /bin/bash=====
Ligne 126: Ligne 119:
  
 <code> <code>
-[trainee@centos7 ~]$ type cd+trainee@debian11:~$ type cd
 cd is a shell builtin cd is a shell builtin
 </code> </code>
Ligne 133: Ligne 126:
  
 <code> <code>
-[trainee@centos8 ~]$ type cd +trainee@debian11:~$ type ip 
-cd is a shell builtin+ip is /usr/bin/ip
 </code> </code>
  
Ligne 142: Ligne 135:
  
 <code> <code>
-[trainee@centos8 ~]$ type ls+trainee@debian11:~$ type ls
 ls is aliased to `ls --color=auto' ls is aliased to `ls --color=auto'
 </code> </code>
  
-<WRAP center round important 60%>+<WRAP center round important>
 **Important** : Notez que dans ce cas l'alias **ls** est en effet un alias qui utilise la **commande** ls elle-même. **Important** : Notez que dans ce cas l'alias **ls** est en effet un alias qui utilise la **commande** ls elle-même.
 </WRAP> </WRAP>
Ligne 153: Ligne 146:
  
 <code> <code>
-[trainee@centos8 ~]$ alias dir='ls -l' +trainee@debian11:~$ alias dir='ls -l' 
-[trainee@centos8 ~]$ dir + 
-total 0 +trainee@debian11:~$ dir 
--rw-rw-r--1 trainee trainee 0 Apr 20 03:46 aac +total 36 
--rw-rw-r--1 trainee trainee 0 Apr 20 03:46 abc +-rw-r--r-- 1 trainee trainee    Jun  2 10:51 aac 
--rw-rw-r--1 trainee trainee 0 Apr 20 03:46 bca +-rw-r--r-- 1 trainee trainee    Jun  2 10:51 abc 
--rw-rw-r--1 trainee trainee 0 Apr 20 03:46 xyz+-rw-r--r-- 1 trainee trainee    Jun  2 10:51 bca 
 +drwxr-xr-x 2 trainee trainee 4096 Apr 25 07:03 Desktop 
 +drwxr-xr-x 2 trainee trainee 4096 Apr 25 07:03 Documents 
 +drwxr-xr-x 2 trainee trainee 4096 Apr 25 07:03 Downloads 
 +drwxr-xr-x 2 trainee trainee 4096 Apr 25 07:03 Music 
 +drwxr-xr-x 2 trainee trainee 4096 Apr 25 07:03 Pictures 
 +drwxr-xr-x 2 trainee trainee 4096 Apr 25 07:03 Public 
 +drwxr-xr-x 2 trainee trainee 4096 Apr 25 07:03 Templates 
 +drwxr-xr-x 2 trainee trainee 4096 Apr 25 07:03 Videos 
 +-rw-r--r-- 1 trainee trainee  443 May 23 14:50 vitext 
 +-rw-r--r-- 1 trainee trainee    Jun  2 10:51 xyz
 </code> </code>
  
-<WRAP center round important 60%>+<WRAP center round important>
 **Important** : Notez que la commande **dir** existe vraiment. Le fait de créer un alias qui s'appelle **dir** implique que l'alias sera exécuté à la place de la commande **dir**. **Important** : Notez que la commande **dir** existe vraiment. Le fait de créer un alias qui s'appelle **dir** implique que l'alias sera exécuté à la place de la commande **dir**.
 </WRAP> </WRAP>
Ligne 169: Ligne 172:
  
 <code> <code>
-[trainee@centos8 ~]$ alias+trainee@debian11:~$ alias
 alias dir='ls -l' alias dir='ls -l'
-alias egrep='egrep --color=auto' 
-alias fgrep='fgrep --color=auto' 
-alias grep='grep --color=auto' 
-alias l.='ls -d .* --color=auto' 
-alias ll='ls -l --color=auto' 
 alias ls='ls --color=auto' alias ls='ls --color=auto'
-alias vi='vim' 
-alias which='(alias; declare -f) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot' 
-alias xzegrep='xzegrep --color=auto' 
-alias xzfgrep='xzfgrep --color=auto' 
-alias xzgrep='xzgrep --color=auto' 
-alias zegrep='zegrep --color=auto' 
-alias zfgrep='zfgrep --color=auto' 
-alias zgrep='zgrep --color=auto' 
 </code> </code>
  
-<WRAP center round important 60%+<WRAP center round important> 
-**Important** : Notez que cette liste contient, sans distinction, les alias définis dans les fichiers de démarrage du système ainsi que l'alias **dir** créé par **trainee** qui n'est que disponible à **trainee** dans le terminal courant.+**Important** : Notez que cette liste peut contenir, sans distinction, les alias définis dans les fichiers de démarrage du système ainsi que l'alias **dir** créé par **trainee** qui n'est disponible qu'à **trainee** dans le terminal courant.
 </WRAP> </WRAP>
  
Ligne 194: Ligne 184:
  
 <code> <code>
-[trainee@centos8 ~]$ \dir +trainee@debian11:~$ \dir 
-aac  abc  bca  xyz+aac  abc  bca  Desktop  Documents  Downloads  Music  Pictures  Public  Templates  Videos  vitext  xyz
 </code> </code>
  
Ligne 201: Ligne 191:
  
 <code> <code>
-[trainee@centos8 ~]$ unalias dir +trainee@debian11:~$ unalias dir 
-[trainee@centos8 ~]$ dir +trainee@debian11:~$ dir 
-aac  abc  bca  xyz+aac  abc  bca  Desktop  Documents  Downloads  Music  Pictures  Public  Templates  Videos  vitext  xyz
 </code> </code>
  
Ligne 211: Ligne 201:
  
 <code> <code>
-[trainee@centos8 ~]$ cat /etc/passwd+trainee@debian11:~$ cat /etc/passwd
 root:x:0:0:root:/root:/bin/bash root:x:0:0:root:/root:/bin/bash
-bin:x:1:1:bin:/bin:/sbin/nologin +daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin 
-daemon:x:2:2:daemon:/sbin:/sbin/nologin +bin:x:2:2:bin:/bin:/usr/sbin/nologin 
-adm:x:3:4:adm:/var/adm:/sbin/nologin +sys:x:3:3:sys:/dev:/usr/sbin/nologin 
-lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin +sync:x:4:65534:sync:/bin:/bin/sync 
-sync:x:5:0:sync:/sbin:/bin/sync +games:x:5:60:games:/usr/games:/usr/sbin/nologin 
-shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown +man:x:6:12:man:/var/cache/man:/usr/sbin/nologin 
-halt:x:7:0:halt:/sbin:/sbin/halt +lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin 
-mail:x:8:12:mail:/var/spool/mail:/sbin/nologin +mail:x:8:8:mail:/var/mail:/usr/sbin/nologin 
-operator:x:11:0:operator:/root:/sbin/nologin +news:x:9:9:news:/var/spool/news:/usr/sbin/nologin 
-games:x:12:100:games:/usr/games:/sbin/nologin +uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin 
-ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin +proxy:x:13:13:proxy:/bin:/usr/sbin/nologin 
-nobody:x:65534:65534:Kernel Overflow User:/:/sbin/nologin +www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin 
-dbus:x:81:81:System message bus:/:/sbin/nologin +backup:x:34:34:backup:/var/backups:/usr/sbin/nologin 
-systemd-coredump:x:999:997:systemd Core Dumper:/:/sbin/nologin +list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin 
-systemd-resolve:x:193:193:systemd Resolver:/:/sbin/nologin +irc:x:39:39:ircd:/run/ircd:/usr/sbin/nologin 
-tss:x:59:59:Account used by the trousers package to sandbox the tcsd daemon:/dev/null:/sbin/nologin +gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin 
-polkitd:x:998:996:User for polkitd:/:/sbin/nologin +nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin 
-unbound:x:997:994:Unbound DNS resolver:/etc/unbound:/sbin/nologin +_apt:x:100:65534::/nonexistent:/usr/sbin/nologin 
-libstoragemgmt:x:996:993:daemon account for libstoragemgmt:/var/run/lsm:/sbin/nologin +systemd-network:x:101:102:systemd Network Management,,,:/run/systemd:/usr/sbin/nologin 
-cockpit-ws:x:995:991:User for cockpit-ws:/nonexisting:/sbin/nologin +systemd-resolve:x:102:103:systemd Resolver,,,:/run/systemd:/usr/sbin/nologin 
-sssd:x:994:990:User for sssd:/:/sbin/nologin +messagebus:x:103:109::/nonexistent:/usr/sbin/nologin 
-setroubleshoot:x:993:989::/var/lib/setroubleshoot:/sbin/nologin +systemd-timesync:x:104:110:systemd Time Synchronization,,,:/run/systemd:/usr/sbin/nologin 
-sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin +usbmux:x:105:46:usbmux daemon,,,:/var/lib/usbmux:/usr/sbin/nologin 
-chrony:x:992:988::/var/lib/chrony:/sbin/nologin +rtkit:x:106:113:RealtimeKit,,,:/proc:/usr/sbin/nologin 
-tcpdump:x:72:72::/:/sbin/nologin +dnsmasq:x:107:65534:dnsmasq,,,:/var/lib/misc:/usr/sbin/nologin 
-trainee:x:1000:1000:trainee:/home/trainee:/bin/bash +avahi:x:108:114:Avahi mDNS daemon,,,:/run/avahi-daemon:/usr/sbin/nologin 
-cockpit-wsinstance:x:991:987:User for cockpit-ws instances:/nonexisting:/sbin/nologin +speech-dispatcher:x:109:29:Speech Dispatcher,,,:/run/speech-dispatcher:/bin/false 
-rngd:x:990:986:Random Number Generator Daemon:/var/lib/rngd:/sbin/nologin +pulse:x:110:116:PulseAudio daemon,,,:/run/pulse:/usr/sbin/nologin 
-gluster:x:989:985:GlusterFS daemons:/run/gluster:/sbin/nologin +saned:x:111:119::/var/lib/saned:/usr/sbin/nologin 
-qemu:x:107:107:qemu user:/:/sbin/nologin +colord:x:112:120:colord colour management daemon,,,:/var/lib/colord:/usr/sbin/nologin 
-rpc:x:32:32:Rpcbind Daemon:/var/lib/rpcbind:/sbin/nologin +lightdm:x:113:121:Light Display Manager:/var/lib/lightdm:/bin/false 
-rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin +trainee:x:1000:1000:trainee,,,:/home/trainee:/bin/bash 
-saslauth:x:988:76:Saslauthd user:/run/saslauthd:/sbin/nologin +systemd-coredump:x:999:999:systemd Core Dumper:/:/usr/sbin/nologin 
-radvd:x:75:75:radvd user:/:/sbin/nologin +sshd:x:114:65534::/run/sshd:/usr/sbin/nologin
-dnsmasq:x:983:983:Dnsmasq DHCP and DNS server:/var/lib/dnsmasq:/sbin/nologin+
 </code> </code>
  
Ligne 253: Ligne 242:
  
 <code> <code>
-[trainee@centos8 ~]$ cat /etc/shells+trainee@debian11:~$ cat /etc/shells 
 +# /etc/shells: valid login shells
 /bin/sh /bin/sh
 /bin/bash /bin/bash
-/usr/bin/sh 
 /usr/bin/bash /usr/bin/bash
 +/bin/rbash
 +/usr/bin/rbash
 +/bin/dash
 +/usr/bin/dash
 +/usr/bin/screen
 </code> </code>
  
Ligne 263: Ligne 257:
  
 <code> <code>
-[trainee@centos8 ~]$ echo $SHELL+trainee@debian11:~$ echo $SHELL
 /bin/bash /bin/bash
 </code> </code>
  
-<WRAP center round important 60%> +Notez sous Debian 11 que le système nous informe que le shell courant de l'utiisateur **trainee** est **/bin/bash** et non **/usr/bin/bash**. Ceci est du au fait que le répertoire /bin est un lien symbolique pointant vers le répertoire /usr/bin 
-**Important** : Notez sous RHEL/CentOS 8 que le système nous informe que le shell courant de l'utiisateur **trainee** est **/bin/bash** et non **/usr/bin/bash**. Ceci est du au fait que le répertoire /bin est un lien symbolique pointant vers le répertoire /usr/bin. + 
-</WRAP>+<code> 
 +trainee@debian11:~$ ls -l / 
 +total 256064 
 +lrwxrwxrwx   1 root root         7 Apr 25 06:26 bin -> usr/bin 
 +drwxr-xr-x   3 root root      4096 Apr 25 06:54 boot 
 +drwxr-xr-x  17 root root      3300 Jun  2 09:42 dev 
 +drwxr-xr-x 112 root root      4096 Jun  2 15:07 etc 
 +-rw-r--r--   1 root root 262144000 Jun  2 14:41 file 
 +drwxr-xr-x   3 root root      4096 Apr 25 07:01 home 
 +lrwxrwxrwx   1 root root        31 Apr 25 06:31 initrd.img -> boot/initrd.img-5.10.0-13-amd64 
 +lrwxrwxrwx   1 root root        31 Apr 25 06:31 initrd.img.old -> boot/initrd.img-5.10.0-13-amd64 
 +lrwxrwxrwx   1 root root         7 Apr 25 06:26 lib -> usr/lib 
 +lrwxrwxrwx   1 root root         9 Apr 25 06:26 lib32 -> usr/lib32 
 +lrwxrwxrwx   1 root root         9 Apr 25 06:26 lib64 -> usr/lib64 
 +lrwxrwxrwx   1 root root        10 Apr 25 06:26 libx32 -> usr/libx32 
 +drwx------   2 root root     16384 Apr 25 06:26 lost+found 
 +drwxr-xr-x   3 root root      4096 Apr 25 06:26 media 
 +drwxr-xr-x   2 root root      4096 Apr 25 06:27 mnt 
 +drwxr-xr-x   2 root root      4096 Apr 25 06:27 opt 
 +dr-xr-xr-x 194 root root         0 May 10 14:37 proc 
 +drwx------   3 root root      4096 Jun  2 15:01 root 
 +drwxr-xr-x  25 root root       680 Jun  2 11:13 run 
 +lrwxrwxrwx   1 root root         8 Apr 25 06:26 sbin -> usr/sbin 
 +drwxr-xr-x   2 root root      4096 Apr 25 06:27 srv 
 +dr-xr-xr-x  13 root root         0 May 10 14:37 sys 
 +drwxrwxrwt  14 root root      4096 Jun  2 15:07 tmp 
 +drwxr-xr-x  14 root root      4096 Apr 25 06:27 usr 
 +drwxr-xr-x  11 root root      4096 Apr 25 06:27 var 
 +lrwxrwxrwx   1 root root        28 Apr 25 06:31 vmlinuz -> boot/vmlinuz-5.10.0-13-amd64 
 +lrwxrwxrwx   1 root root        28 Apr 25 06:31 vmlinuz.old -> boot/vmlinuz-5.10.0-13-amd64 
 +</code>
  
 Changez ensuite le shell de **trainee** en utilisant la commande **chsh** en indiquant la valeur de **/bin/sh** pour le nouveau shell : Changez ensuite le shell de **trainee** en utilisant la commande **chsh** en indiquant la valeur de **/bin/sh** pour le nouveau shell :
  
 <code> <code>
-[trainee@centos8 ~]$ chsh +trainee@debian11:~$ chsh
-Changing shell for trainee. +
-New shell [/bin/bash] +
-/bin/sh+
 Password: trainee Password: trainee
-Shell changed.+Changing the login shell for trainee 
 +Enter the new value, or press ENTER for the default 
 +        Login Shell [/bin/bash]: /bin/sh
 </code> </code>
  
-<WRAP center round important 60%>+<WRAP center round important>
 **Important** : Notez que le mot de passe saisi ne sera **pas** visible. **Important** : Notez que le mot de passe saisi ne sera **pas** visible.
 </WRAP> </WRAP>
Ligne 289: Ligne 312:
  
 <code> <code>
-[trainee@centos8 ~]$ echo $SHELL+trainee@debian11:~$ echo $SHELL
 /bin/bash /bin/bash
 </code> </code>
Ligne 296: Ligne 319:
  
 <code> <code>
-[trainee@centos8 ~]$ cat /etc/passwd | grep trainee +trainee@debian11:~$ cat /etc/passwd | grep trainee 
-trainee:x:1000:1000:trainee:/home/trainee:/bin/sh+trainee:x:1000:1000:trainee,,,:/home/trainee:/bin/sh
 </code> </code>
  
-<WRAP center round important 60%>+<WRAP center round important>
 **Important** : Vous noterez que le shell actif est toujours **/bin/bash** tandis que le shell stipulé dans le fichier /etc/passwd est le **/bin/sh**. Le shell **/bin/sh** ne deviendra le shell actif de **trainee** que lors de sa prochaine connexion au système. **Important** : Vous noterez que le shell actif est toujours **/bin/bash** tandis que le shell stipulé dans le fichier /etc/passwd est le **/bin/sh**. Le shell **/bin/sh** ne deviendra le shell actif de **trainee** que lors de sa prochaine connexion au système.
 </WRAP> </WRAP>
Ligne 307: Ligne 330:
  
 <code> <code>
-[trainee@centos8 ~]$ chsh +trainee@debian11:~$ chsh
-Changing shell for trainee. +
-New shell [/bin/sh]: /bin/bash+
 Password: trainee Password: trainee
-Shell changed.+Changing the login shell for trainee 
 +Enter the new value, or press ENTER for the default 
 +        Login Shell [/bin/sh]: /bin/bash
 </code> </code>
  
-<WRAP center round important 60%>+<WRAP center round important>
 **Important** : Notez que le mot de passe saisi ne sera **pas** visible. **Important** : Notez que le mot de passe saisi ne sera **pas** visible.
 </WRAP> </WRAP>
Ligne 330: Ligne 353:
  
 <code> <code>
-[trainee@centos8 ~]$ history | more+trainee@debian11:~$ history | more
     1  su -     1  su -
     2  exit     2  exit
-    3  su - +    3  cd / 
-    4  nmcli c show +    4  ls -l 
-    5  stty -a +    5  su 
-    6  date +    6  vi vitext 
-    7  who +    7  view vitext 
-    8  df +    8  vi vitext 
-    9  df -h +    9  vi .exrc 
-   10  free free -h +   10  cat .exrc 
-   11  free +   11  vi vitext 
-   12  free -h +   12  type ifconfig 
-   13  whoami +   13  type ip 
-   14  su +   14  ip --help 
-   15  pwd +   15  type type 
-   16  cd /tmp +   16  help 
-   17  pwd +   17  help type 
-   18  ls +   18  man passwd 
-   19  su - +   19  whereis passwd 
-   20  touch test +   20  man 5 passwd 
-   21  ls +   21  su - 
-   22  echo fenestros +   22  stty -a 
-   23  cp test ~+   23  date 
 +   24  who 
 +   25  df 
 +   26  df -h 
 +   27  free 
 +   28  free -h 
 +   29  whoami 
 +   30  su - 
 +   31  pwd 
 +   32  cd /tmp
 --More-- --More--
 +[q]
 </code> </code>
  
-<WRAP center round important 60%>+<WRAP center round important>
 **Important**: L'historique est spécifique à chaque utilisateur. **Important**: L'historique est spécifique à chaque utilisateur.
 </WRAP> </WRAP>
Ligne 386: Ligne 419:
  
 <code> <code>
-[trainee@centos8 ~]$ ls +trainee@debian11:~$ ls 
-aac  abc  bca  xyz +aac  abc  bca  Desktop  Documents  Downloads  Music  Pictures  Public  Templates  Videos  vitext  xyz 
-[trainee@centos8 ~]$ !!+trainee@debian11:~$ !!
 ls ls
-aac  abc  bca  xyz+aac  abc  bca  Desktop  Documents  Downloads  Music  Pictures  Public  Templates  Videos  vitext  xyz
 </code> </code>
  
Ligne 396: Ligne 429:
  
 <code> <code>
-[trainee@centos8 ~]$ history+trainee@debian11:~$ history
     1  su -     1  su -
 ... ...
-   80  history | more +   94  chsh 
-   81  ls +   95  echo $SHELL 
-   82  history +   96  cat /etc/passwd | grep trainee 
-[trainee@centos8 ~]$ !81+   97  chsh 
 +   98  history | more 
 +   99  ls 
 +  100  history 
 +trainee@debian11:~$ !99
 ls ls
-aac  abc  bca  xyz+aac  abc  bca  Desktop  Documents  Downloads  Music  Pictures  Public  Templates  Videos  vitext  xyz
 </code> </code>
  
-Le paramétrage de la fonction du rappel des commandes est fait pour tous les utilisateurs dans le fichier **/etc/profile**. Dans ce fichier, les variables concernant le rappel des commandes peuvent être définis. Le plus important est **HISTSIZE** :+Le paramétrage de la fonction du rappel des commandes est fait pour chaque utilisateur individuellement dans le fichier **~/.bashrc où** ~/ indique le répertoire personnel de l'utilisateur concerné. Dans ce fichier, les variables concernant le rappel des commandes peuvent être définis. Le plus important est **HISTSIZE** :
  
 <code> <code>
-[trainee@centos8 ~]$ cat /etc/profile | grep HISTSIZE+trainee@debian11:~$ cat .bashrc | grep HISTSIZE 
 +# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
 HISTSIZE=1000 HISTSIZE=1000
-export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL 
 </code> </code>
  
Ligne 420: Ligne 457:
  
 <code> <code>
-[trainee@centos8 ~]$ nl .bash_history | tail +trainee@debian11:~$ nl .bash_history | more 
-    54 ls +     1  su - 
-    55 ls | sort +      exit 
-    56 ls | sort -r +      cd / 
-    57 more /etc/services +     4  ls -l 
-    58 less /etc/services +      su - 
-    59 find acc +      vi vitext 
-    60 find aac +      view vitext 
-    61 su - +      vi vitext 
-    62 sleep 10 +      vi .exrc 
-    63 su -+    10  cat .exrc 
 +    11  vi vitext 
 +    12  type ifconfig 
 +    13  type ip 
 +    14  ip --help 
 +    15  type type 
 +    16  help 
 +    17  help type 
 +    18  man passwd 
 +    19  whereis passwd 
 +    20  man 5 passwd 
 +    21  su -
 </code> </code>
  
-<WRAP center round important 60%>+<WRAP center round important>
 **Important** : Notez l'utilisation de la commande **nl** pour numéroter les lignes de l'affichage du contenu du fichier **.bash_history**. **Important** : Notez l'utilisation de la commande **nl** pour numéroter les lignes de l'affichage du contenu du fichier **.bash_history**.
 </WRAP> </WRAP>
Ligne 444: Ligne 492:
  
 <code> <code>
-[trainee@centos8 ~]$ ls .bash +trainee@debian11:~$ ls .bash 
-.bash_history  .bash_logout   .bash_profile  .bashrc +.bash_history  .bash_logout   .bashrc 
 </code> </code>
  
-<WRAP center round important 60%>+<WRAP center round important>
 **Important** : Notez qu'en appuyant sur la touche <key>tab</key> trois fois le shell propose 4 possibilités de complétion de nom de fichier. En effet, sans plus d'information, le shell ne sait pas quel fichier est concerné. **Important** : Notez qu'en appuyant sur la touche <key>tab</key> trois fois le shell propose 4 possibilités de complétion de nom de fichier. En effet, sans plus d'information, le shell ne sait pas quel fichier est concerné.
 </WRAP> </WRAP>
Ligne 459: Ligne 507:
  
 <code> <code>
-[trainee@centos8 ~]$ mo +trainee@debian11:~$ mo 
-modinfo                more                   mount.nfs4 +moggsplit   more        mount       mountpoint  mousepad  
-modprobe               mount                  mountpoint +
-modulemd-validator     mount.fuse             mountstats +
-modulemd-validator-v1  mount.nfs +
 </code> </code>
  
Ligne 486: Ligne 531:
  
 <code> <code>
-[trainee@centos8 ~]$ mkdir training +trainee@debian11:~$ mkdir training 
-[trainee@centos8 ~]$ cd training +trainee@debian11:~$ cd training 
-[trainee@centos8 training]$ touch f1 f2 f3 f4 f5 +trainee@debian11:~/training$ touch f1 f2 f3 f4 f5 
-[trainee@centos8 training]$ ls+trainee@debian11:~/training$ ls
 f1  f2  f3  f4  f5 f1  f2  f3  f4  f5
 </code> </code>
Ligne 496: Ligne 541:
  
 <code> <code>
-[trainee@centos8 training]$ echo f*+trainee@debian11:~/training$ echo f*
 f1 f2 f3 f4 f5 f1 f2 f3 f4 f5
 </code> </code>
  
-<WRAP center round important 60%>+<WRAP center round important>
 **Important** : Notez que le caractère ***** remplace un caractère ou une suite de caractères. **Important** : Notez que le caractère ***** remplace un caractère ou une suite de caractères.
 </WRAP> </WRAP>
Ligne 509: Ligne 554:
  
 <code> <code>
-[trainee@centos8 training]$ touch f52 f62+trainee@debian11:~/training$ touch f52 f62
 </code> </code>
  
Ligne 515: Ligne 560:
  
 <code> <code>
-[trainee@centos8 training]$ echo f?2+trainee@debian11:~/training$ echo f?2
 f52 f62 f52 f62
 </code> </code>
  
-<WRAP center round important 60%>+<WRAP center round important>
 **Important** : Notez que le caractère **?** remplace **un seul** caractère. **Important** : Notez que le caractère **?** remplace **un seul** caractère.
 </WRAP> </WRAP>
Ligne 536: Ligne 581:
  
 <code> <code>
-[trainee@centos8 training]$ touch a100+trainee@debian11:~/training$ touch a100
 </code> </code>
  
Ligne 542: Ligne 587:
  
 <code> <code>
-[trainee@centos8 training]$ echo [a-f]*+trainee@debian11:~/training$ echo [a-f]*
 a100 f1 f2 f3 f4 f5 f52 f62 a100 f1 f2 f3 f4 f5 f52 f62
 </code> </code>
  
-<WRAP center round important 60%>+<WRAP center round important>
 **Important** : Notez ici que tous les fichiers commençant par les lettres **a**, **b**, **c**, **d**, **e** ou **f** sont affichés à l'écran. **Important** : Notez ici que tous les fichiers commençant par les lettres **a**, **b**, **c**, **d**, **e** ou **f** sont affichés à l'écran.
 </WRAP> </WRAP>
  
 <code> <code>
-[trainee@centos8 training]$ echo [af]*+trainee@debian11:~/training$ echo [af]*
 a100 f1 f2 f3 f4 f5 f52 f62 a100 f1 f2 f3 f4 f5 f52 f62
 </code> </code>
  
-<WRAP center round important 60%>+<WRAP center round important>
 **Important** : Notez ici que tous les fichiers commençant par les lettres **a** ou **f** sont affichés à l'écran. **Important** : Notez ici que tous les fichiers commençant par les lettres **a** ou **f** sont affichés à l'écran.
 </WRAP> </WRAP>
  
 <code> <code>
-[trainee@centos8 training]$ echo [!a]*+trainee@debian11:~/training$ echo [!a]*
 f1 f2 f3 f4 f5 f52 f62 f1 f2 f3 f4 f5 f52 f62
 </code> </code>
  
-<WRAP center round important 60%>+<WRAP center round important>
 **Important** : Notez ici que tous les fichiers sont affichés à l'écran, à l'exception d'un fichier commençant par la lettre **a** . **Important** : Notez ici que tous les fichiers sont affichés à l'écran, à l'exception d'un fichier commençant par la lettre **a** .
 </WRAP> </WRAP>
  
 <code> <code>
-[trainee@centos8 training]$ echo [a-b]*+trainee@debian11:~/training$ echo [a-b]*
 a100 a100
 </code> </code>
  
-<WRAP center round important 60%>+<WRAP center round important>
 **Important** : Notez ici que seul le fichier commençant par la lettre **a** est affiché à l'écran car il n'existe pas de fichiers commençant par la lettre **b**. **Important** : Notez ici que seul le fichier commençant par la lettre **a** est affiché à l'écran car il n'existe pas de fichiers commençant par la lettre **b**.
 </WRAP> </WRAP>
  
 <code> <code>
-[trainee@centos8 training]$ echo [a-f]+trainee@debian11:~/training$ echo [a-f]
 [a-f] [a-f]
 </code> </code>
  
-<WRAP center round important 60%>+<WRAP center round important>
 **Important** : Notez que dans ce cas, il n'existe pas de fichiers dénommés **a**, **b**, **c**, **d**, **e** ou **f**. Pour cette raison, n'ayant trouvé aucune correspondance entre le filtre utilisé et les objets dans le répertoire courant, le commande **echo** retourne le filtre passé en argument, c'est-à-dire **[a-f]**. **Important** : Notez que dans ce cas, il n'existe pas de fichiers dénommés **a**, **b**, **c**, **d**, **e** ou **f**. Pour cette raison, n'ayant trouvé aucune correspondance entre le filtre utilisé et les objets dans le répertoire courant, le commande **echo** retourne le filtre passé en argument, c'est-à-dire **[a-f]**.
 </WRAP> </WRAP>
Ligne 591: Ligne 636:
  
 <code> <code>
-[trainee@centos8 training]$ shopt -s extglob+trainee@debian11:~/training$ shopt -s extglob
 </code> </code>
  
Ligne 597: Ligne 642:
  
 <code> <code>
-[trainee@centos8 training]$ shopt +trainee@debian11:~/training$ shopt 
-autocd         off +autocd          off 
-cdable_vars     off +assoc_expand_once       off 
-cdspell         off +cdable_vars     off 
-checkhash       off +cdspell         off 
-checkjobs       off +checkhash       off 
-checkwinsize   on +checkjobs       off 
-cmdhist         on +checkwinsize    on 
-compat31       off +cmdhist         on 
-compat32       off +compat31        off 
-compat40       off +compat32        off 
-compat41       off +compat40        off 
-direxpand       off +compat41        off 
-dirspell       off +compat42        off 
-dotglob         off +compat43        off 
-execfail       off +compat44        off 
-expand_aliases  on +complete_fullquote      on 
-extdebug       off +direxpand       off 
-extglob         on +dirspell        off 
-extquote       on +dotglob         off 
-failglob       off +execfail        off 
-force_fignore   on +expand_aliases  on 
-globstar       off +extdebug        off 
-gnu_errfmt     off +extglob         on 
-histappend     on +extquote        on 
-histreedit     off +failglob        off 
-histverify     off +force_fignore   on 
-hostcomplete   off +globasciiranges on 
-huponexit       off +globstar        off 
-interactive_comments on +gnu_errfmt      off 
-lastpipe       off +histappend      on 
-lithist         off +histreedit      off 
-login_shell     on +histverify      off 
-mailwarn       off +hostcomplete    off 
-no_empty_cmd_completion off +huponexit       off 
-nocaseglob     off +inherit_errexit off 
-nocasematch     off +interactive_comments    on 
-nullglob       off +lastpipe        off 
-progcomp       on +lithist         off 
-promptvars     on +localvar_inherit        off 
-restricted_shell off +localvar_unset  off 
-shift_verbose   off +login_shell     on 
-sourcepath     on +mailwarn        off 
-xpg_echo       of+no_empty_cmd_completion off 
 +nocaseglob      off 
 +nocasematch     off 
 +nullglob        off 
 +progcomp        on 
 +progcomp_alias  off 
 +promptvars      on 
 +restricted_shell        off 
 +shift_verbose   off 
 +sourcepath      on 
 +xpg_echo        off
 </code> </code>
  
Ligne 648: Ligne 703:
  
 <code> <code>
-[trainee@centos8 training]$ touch f f.txt f123.txt f123123.txt f123123123.txt+trainee@debian11:~/training$ touch f f.txt f123.txt f123123.txt f123123123.txt
 </code> </code>
  
Ligne 654: Ligne 709:
  
 <code> <code>
-[trainee@centos8 training]$ ls f?(123).txt+trainee@debian11:~/training$ ls f?(123).txt
 f123.txt  f.txt f123.txt  f.txt
 </code> </code>
  
-<WRAP center round important 60%>+<WRAP center round important>
 **Important** : Notez ici que la commande affiche les fichiers ayant un nom contenant 0 ou 1 occurence de la chaîne **123**. **Important** : Notez ici que la commande affiche les fichiers ayant un nom contenant 0 ou 1 occurence de la chaîne **123**.
 </WRAP> </WRAP>
Ligne 667: Ligne 722:
  
 <code> <code>
-[trainee@centos8 training]$ ls f*(123).txt+trainee@debian11:~/training$ ls f*(123).txt
 f123123123.txt  f123123.txt  f123.txt  f.txt f123123123.txt  f123123.txt  f123.txt  f.txt
 </code> </code>
  
-<WRAP center round important 60%>+<WRAP center round important>
 **Important** : Notez ici que la commande affiche les fichiers ayant un nom contenant de 0 jusqu'à x occurences de la chaîne **123**. **Important** : Notez ici que la commande affiche les fichiers ayant un nom contenant de 0 jusqu'à x occurences de la chaîne **123**.
 </WRAP> </WRAP>
Ligne 680: Ligne 735:
  
 <code> <code>
-[trainee@centos8 training]$ ls f+(123).txt+trainee@debian11:~/training$ ls f+(123).txt
 f123123123.txt  f123123.txt  f123.txt f123123123.txt  f123123.txt  f123.txt
 </code> </code>
  
-<WRAP center round important 60%>+<WRAP center round important>
 **Important** : Notez ici que la commande affiche les fichiers ayant un nom contenant entre 1 et x occurences de la chaîne **123**. **Important** : Notez ici que la commande affiche les fichiers ayant un nom contenant entre 1 et x occurences de la chaîne **123**.
 </WRAP> </WRAP>
Ligne 693: Ligne 748:
  
 <code> <code>
-[trainee@centos8 training]$ ls f@(123).txt+trainee@debian11:~/training$ ls f@(123).txt
 f123.txt f123.txt
 </code> </code>
  
-<WRAP center round important 60%>+<WRAP center round important>
 **Important** : Notez ici que la commande affiche les fichiers ayant un nom contenant 1 seule occurence de la chaîne **123**. **Important** : Notez ici que la commande affiche les fichiers ayant un nom contenant 1 seule occurence de la chaîne **123**.
 </WRAP> </WRAP>
Ligne 706: Ligne 761:
  
 <code> <code>
-[trainee@centos8 training]$ ls f!(123).txt+trainee@debian11:~/training$ ls f!(123).txt
 f123123123.txt  f123123.txt  f.txt f123123123.txt  f123123.txt  f.txt
 </code> </code>
  
-<WRAP center round important 60%>+<WRAP center round important>
 **Important** : Notez ici que la commande n'affiche que les fichiers ayant un nom qui ne contient **pas** la chaîne **123**. **Important** : Notez ici que la commande n'affiche que les fichiers ayant un nom qui ne contient **pas** la chaîne **123**.
 </WRAP> </WRAP>
Ligne 730: Ligne 785:
  
 <code> <code>
-[trainee@centos8 training]$ echo * est un caractère spécial+trainee@debian11:~/training$ echo * est un caractère spécial
 a100 f f1 f123123123.txt f123123.txt f123.txt f2 f3 f4 f5 f52 f62 f.txt est un caractère spécial a100 f f1 f123123123.txt f123123.txt f123.txt f2 f3 f4 f5 f52 f62 f.txt est un caractère spécial
  
-[trainee@centos8 training]$ echo \* est un caractère spécial+trainee@debian11:~/training$ echo \* est un caractère spécial
 * est un caractère spécial * est un caractère spécial
  
-[trainee@centos8 training]$ echo "* est un caractère spécial"+trainee@debian11:~/training$ echo "* est un caractère spécial"
 * est un caractère spécial * est un caractère spécial
  
-[trainee@centos8 training]$ echo '* est un caractère spécial'+trainee@debian11:~/training$ echo '* est un caractère spécial'
 * est un caractère spécial * est un caractère spécial
 </code> </code>
Ligne 750: Ligne 805:
  
 <code> <code>
-[trainee@centos8 training]$ cd .. +trainee@debian11:~/training$ cd .. 
-[trainee@centos8 ~]$ mkdir codes + 
-[trainee@centos8 ~]$ echo $?+trainee@debian11:~$ mkdir codes 
 + 
 +trainee@debian11:~$ echo $?
 0 0
-[trainee@centos8 ~]$ touch codes/exit.txt + 
-[trainee@centos8 ~]$ rmdir codes +trainee@debian11:~$ touch codes/exit.txt 
-rmdir: failed to remove codes: Directory not empty + 
-[trainee@centos8 ~]$ echo $?+trainee@debian11:~$ rmdir codes 
 +rmdir: failed to remove 'codes': Directory not empty 
 + 
 +trainee@debian11:~$ echo $?
 1 1
 </code> </code>
Ligne 784: Ligne 844:
  
 <code> <code>
-[trainee@centos8 ~]$ pwd+trainee@debian11:~$ pwd
 /home/trainee /home/trainee
-[trainee@centos8 ~]$ cd training + 
-[trainee@centos8 training]$ free > file +trainee@debian11:~$ cd training 
-[trainee@centos8 training]$ cat file + 
-              total        used        free      shared  buff/cache   available +trainee@debian11:~/training$ free > file 
-Mem:         500780      192692       38916        4824      269172      260472 + 
-Swap:       2096124           0     2096124+trainee@debian11:~/training$ cat file 
 +               total        used        free      shared  buff/cache   available 
 +Mem:         4025596      406752     1852912        4836     1765932     3324440 
 +Swap:         998396           0      998396
 </code> </code>
  
Ligne 799: Ligne 862:
  
 <code> <code>
-[trainee@centos8 training]$ date > file +trainee@debian11:~/training$ date > file 
-[trainee@centos8 training]$ cat file + 
-Mon 28 Nov 15:48:09 CET 2016+trainee@debian11:~/training$ cat file 
 +Fri 03 Jun 2022 05:10:47 PM CEST
 </code> </code>
  
Ligne 807: Ligne 871:
  
 <code> <code>
-[trainee@centos8 training]$ free >> file +trainee@debian11:~/training$ free >> file 
-[trainee@centos8 training]$ cat file + 
-Mon 28 Nov 15:48:09 CET 2016 +trainee@debian11:~/training$ cat file 
-              total        used        free      shared  buff/cache   available +Fri 03 Jun 2022 05:10:47 PM CEST 
-Mem:         500780      192792       38516        4824      269472      260376 +               total        used        free      shared  buff/cache   available 
-Swap:       2096124           0     2096124+Mem:         4025596      406708     1852952        4836     1765936     3324484 
 +Swap:         998396           0      998396
 </code> </code>
  
 De cette façon, la date du jour sera rajoutée à la fin de votre fichier après les informations de la commande free. De cette façon, la date du jour sera rajoutée à la fin de votre fichier après les informations de la commande free.
  
-<WRAP center round important 60%>+<WRAP center round important>
 **Important** : Notez que la sortie standard ne peut être redirigée que dans **une seule direction**.  **Important** : Notez que la sortie standard ne peut être redirigée que dans **une seule direction**. 
 </WRAP> </WRAP>
Ligne 830: Ligne 895:
  
 <code> <code>
-[trainee@centos8 training]$ cd .. +trainee@debian11:~/training$ cd .. 
-[trainee@centos8 ~]$ rmdir training/ 2>errorlog + 
-[trainee@centos8 ~]$ cat errorlog +trainee@debian11:~$ rmdir training/ 2>errorlog 
-rmdir: failed to remove training/: Directory not empty+ 
 +trainee@debian11:~$ cat errorlog  
 + 
 +rmdir: failed to remove 'training/': Directory not empty
 </code> </code>
  
Ligne 843: Ligne 911:
  
 <code> <code>
-[trainee@centos8 ~]$ free > file 2>&1+trainee@debian11:~$ free > file 2>&1
 </code> </code>
  
Ligne 851: Ligne 919:
  
 <code> <code>
-[trainee@centos8 ~]$ wc -w < errorlog+trainee@debian11:~$ wc -w < errorlog
 8 8
 </code> </code>
Ligne 871: Ligne 939:
  
 <code> <code>
-[trainee@centos8 ~]$ ls | wc -w +trainee@debian11:~$ ls | wc -w 
-7+17 
 + 
 +trainee@debian11:~$ ls -a | wc -w 
 +33
 </code> </code>
  
 Cette commande, lancée dans votre répertoire personnel, prend la sortie de la commande **ls** et demande à la commande **wc** de compter le nombre de mots inclus dans la sortie de ls : Cette commande, lancée dans votre répertoire personnel, prend la sortie de la commande **ls** et demande à la commande **wc** de compter le nombre de mots inclus dans la sortie de ls :
  
-<WRAP center round important 60%>+<WRAP center round important>
 **Important** : Il est à noter qu'il est possible de relier plusieurs tubes dans la même commande. **Important** : Il est à noter qu'il est possible de relier plusieurs tubes dans la même commande.
 </WRAP> </WRAP>
Ligne 884: Ligne 955:
  
 <code> <code>
-[trainee@centos8 ~]$ date | tee file1 +trainee@debian11:~$ date | tee file1 
-Tue 20 Apr 10:39:47 EDT 2021 +Fri 03 Jun 2022 05:15:26 PM CEST 
-[trainee@centos8 ~]$ cat file1 + 
-Tue 20 Apr 10:39:47 EDT 2021+trainee@debian11:~$ cat file1 
 +Fri 03 Jun 2022 05:15:26 PM CEST
 </code> </code>
  
Ligne 893: Ligne 965:
  
 <code> <code>
-[trainee@centos8 ~]$ date | tee file1 > file2 +trainee@debian11:~$ date | tee file1 > file2 
-[trainee@centos8 ~]$ cat file1 + 
-Tue 20 Apr 10:40:36 EDT 2021 +trainee@debian11:~$ cat file1 
-[trainee@centos8 ~]$ cat file2 +Fri 03 Jun 2022 05:16:03 PM CEST 
-Tue 20 Apr 10:40:36 EDT 2021+ 
 +trainee@debian11:~$ cat file2 
 +Fri 03 Jun 2022 05:16:03 PM CEST
 </code> </code>
  
-<WRAP center round important 60%>+<WRAP center round important>
 **Important** : Par défaut la commande tee écrase le fichier de destination. Pour ajouter des données supplémentaires au même fichier cible, il convient d'utiliser l'option **-a** de la commande tee. **Important** : Par défaut la commande tee écrase le fichier de destination. Pour ajouter des données supplémentaires au même fichier cible, il convient d'utiliser l'option **-a** de la commande tee.
 </WRAP> </WRAP>
Ligne 909: Ligne 983:
  
 <code> <code>
-[trainee@centos8 ~]$ echo date+trainee@debian11:~$ echo date
 date date
-[trainee@centos8 ~]$ echo $(date) + 
-Tue 20 Apr 10:41:33 EDT 2021 +trainee@debian11:~$ echo $(date) 
-[trainee@centos8 ~]$ echo `date` +Fri 03 Jun 2022 05:17:06 PM CEST 
-Tue 20 Apr 10:41:45 EDT 2021+ 
 +trainee@debian11:~$ echo `date` 
 +Fri 03 Jun 2022 05:17:18 PM CEST
 </code> </code>
  
-<WRAP center round important 60%>+<WRAP center round important>
 **Important** : Notez le format de chaque substitution **$(commande)** ou **`commande`**. Sur un clavier français, l'anti-côte est accessible en utilisant les touches <key>Alt Gr</key> et <key>7</key><key>7</key>. **Important** : Notez le format de chaque substitution **$(commande)** ou **`commande`**. Sur un clavier français, l'anti-côte est accessible en utilisant les touches <key>Alt Gr</key> et <key>7</key><key>7</key>.
 </WRAP> </WRAP>
Ligne 1023: Ligne 1099:
  
 <code> <code>
-[trainee@centos8 ~]$ echo $LC_ALL+trainee@debian11:~$ echo $LC_ALL
  
-[trainee@centos8 ~]$ echo $LC_CTYPE 
  
-[trainee@centos8 ~]$ echo $LANG +trainee@debian11:~$ echo $LC_CTYPE 
-en_GB.UTF-8 + 
-[trainee@centos8 ~]$ locale + 
-LANG=en_GB.UTF-8 +trainee@debian11:~$ echo $LANG 
-LC_CTYPE="en_GB.UTF-8" +en_US.UTF-8 
-LC_NUMERIC="en_GB.UTF-8" + 
-LC_TIME="en_GB.UTF-8" +trainee@debian11:~$ locale 
-LC_COLLATE="en_GB.UTF-8" +LANG=en_US.UTF-8 
-LC_MONETARY="en_GB.UTF-8" +LANGUAGE=en_US:en 
-LC_MESSAGES="en_GB.UTF-8" +LC_CTYPE="en_US.UTF-8" 
-LC_PAPER="en_GB.UTF-8" +LC_NUMERIC="en_US.UTF-8" 
-LC_NAME="en_GB.UTF-8" +LC_TIME="en_US.UTF-8" 
-LC_ADDRESS="en_GB.UTF-8" +LC_COLLATE="en_US.UTF-8" 
-LC_TELEPHONE="en_GB.UTF-8" +LC_MONETARY="en_US.UTF-8" 
-LC_MEASUREMENT="en_GB.UTF-8" +LC_MESSAGES="en_US.UTF-8" 
-LC_IDENTIFICATION="en_GB.UTF-8"+LC_PAPER="en_US.UTF-8" 
 +LC_NAME="en_US.UTF-8" 
 +LC_ADDRESS="en_US.UTF-8" 
 +LC_TELEPHONE="en_US.UTF-8" 
 +LC_MEASUREMENT="en_US.UTF-8" 
 +LC_IDENTIFICATION="en_US.UTF-8"
 LC_ALL= LC_ALL=
 </code> </code>
Ligne 1063: Ligne 1143:
  
 <code> <code>
-[trainee@centos8 ~]$ env +trainee@debian11:~$ env 
-LS_COLORS=rs=0:di=38;5;33:ln=38;5;51:mh=00:pi=40;38;5;11:so=38;5;13:do=38;5;5:bd=48;5;232;38;5;11:cd=48;5;232;38;5;3:or=48;5;232;38;5;9:mi=01;05;37;41:su=48;5;196;38;5;15:sg=48;5;11;38;5;16:ca=48;5;196;38;5;226:tw=48;5;10;38;5;16:ow=48;5;10;38;5;21:st=48;5;21;38;5;15:ex=38;5;40:*.tar=38;5;9:*.tgz=38;5;9:*.arc=38;5;9:*.arj=38;5;9:*.taz=38;5;9:*.lha=38;5;9:*.lz4=38;5;9:*.lzh=38;5;9:*.lzma=38;5;9:*.tlz=38;5;9:*.txz=38;5;9:*.tzo=38;5;9:*.t7z=38;5;9:*.zip=38;5;9:*.z=38;5;9:*.dz=38;5;9:*.gz=38;5;9:*.lrz=38;5;9:*.lz=38;5;9:*.lzo=38;5;9:*.xz=38;5;9:*.zst=38;5;9:*.tzst=38;5;9:*.bz2=38;5;9:*.bz=38;5;9:*.tbz=38;5;9:*.tbz2=38;5;9:*.tz=38;5;9:*.deb=38;5;9:*.rpm=38;5;9:*.jar=38;5;9:*.war=38;5;9:*.ear=38;5;9:*.sar=38;5;9:*.rar=38;5;9:*.alz=38;5;9:*.ace=38;5;9:*.zoo=38;5;9:*.cpio=38;5;9:*.7z=38;5;9:*.rz=38;5;9:*.cab=38;5;9:*.wim=38;5;9:*.swm=38;5;9:*.dwm=38;5;9:*.esd=38;5;9:*.jpg=38;5;13:*.jpeg=38;5;13:*.mjpg=38;5;13:*.mjpeg=38;5;13:*.gif=38;5;13:*.bmp=38;5;13:*.pbm=38;5;13:*.pgm=38;5;13:*.ppm=38;5;13:*.tga=38;5;13:*.xbm=38;5;13:*.xpm=38;5;13:*.tif=38;5;13:*.tiff=38;5;13:*.png=38;5;13:*.svg=38;5;13:*.svgz=38;5;13:*.mng=38;5;13:*.pcx=38;5;13:*.mov=38;5;13:*.mpg=38;5;13:*.mpeg=38;5;13:*.m2v=38;5;13:*.mkv=38;5;13:*.webm=38;5;13:*.ogm=38;5;13:*.mp4=38;5;13:*.m4v=38;5;13:*.mp4v=38;5;13:*.vob=38;5;13:*.qt=38;5;13:*.nuv=38;5;13:*.wmv=38;5;13:*.asf=38;5;13:*.rm=38;5;13:*.rmvb=38;5;13:*.flc=38;5;13:*.avi=38;5;13:*.fli=38;5;13:*.flv=38;5;13:*.gl=38;5;13:*.dl=38;5;13:*.xcf=38;5;13:*.xwd=38;5;13:*.yuv=38;5;13:*.cgm=38;5;13:*.emf=38;5;13:*.ogv=38;5;13:*.ogx=38;5;13:*.aac=38;5;45:*.au=38;5;45:*.flac=38;5;45:*.m4a=38;5;45:*.mid=38;5;45:*.midi=38;5;45:*.mka=38;5;45:*.mp3=38;5;45:*.mpc=38;5;45:*.ogg=38;5;45:*.ra=38;5;45:*.wav=38;5;45:*.oga=38;5;45:*.opus=38;5;45:*.spx=38;5;45:*.xspf=38;5;45: +SHELL=/bin/bash 
-SSH_CONNECTION=10.0.2.2 42834 10.0.2.15 22 +LANGUAGE=en_US:en
-LANG=en_GB.UTF-8 +
-HISTCONTROL=ignoredups +
-GUESTFISH_RESTORE=\e[0m +
-HOSTNAME=centos8.ittraining.loc +
-GUESTFISH_INIT=\e[1;34m +
-XDG_SESSION_ID=9 +
-USER=trainee +
-GUESTFISH_PS1=\[\e[1;32m\]><fs>\[\e[0;31m\]  +
-SELINUX_ROLE_REQUESTED=+
 PWD=/home/trainee PWD=/home/trainee
 +LOGNAME=trainee
 +XDG_SESSION_TYPE=tty
 +MOTD_SHOWN=pam
 HOME=/home/trainee HOME=/home/trainee
-SSH_CLIENT=10.0.2.2 42834 22 +LANG=en_US.UTF-8 
-SELINUX_LEVEL_REQUESTED+LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36: 
-SSH_TTY=/dev/pts/+SSH_CONNECTION=10.0.2.1 42590 10.0.2.40 22 
-MAIL=/var/spool/mail/trainee+XDG_SESSION_CLASS=user
 TERM=xterm-256color TERM=xterm-256color
-SHELL=/bin/bash +USER=trainee
-SELINUX_USE_CURRENT_RANGE=+
 SHLVL=1 SHLVL=1
-LOGNAME=trainee+XDG_SESSION_ID=1054 
 +XDG_RUNTIME_DIR=/run/user/1000 
 +SSH_CLIENT=10.0.2.1 42590 22 
 +PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
-XDG_RUNTIME_DIR=/run/user/1000 +SSH_TTY=/dev/pts/1
-PATH=/home/trainee/.local/bin:/home/trainee/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin +
-GUESTFISH_OUTPUT=\e[0m +
-HISTSIZE=1000 +
-LESSOPEN=||/usr/bin/lesspipe.sh %s+
 _=/usr/bin/env _=/usr/bin/env
 OLDPWD=/home/trainee/training OLDPWD=/home/trainee/training
Ligne 1098: Ligne 1170:
 La commande peut aussi être utilisée pour fixer une variable lors de l'exécution d'une commande. Par exemple, pour lancer **xterm** avec la variable EDITOR fixée à **vi** : La commande peut aussi être utilisée pour fixer une variable lors de l'exécution d'une commande. Par exemple, pour lancer **xterm** avec la variable EDITOR fixée à **vi** :
  
-  $ env EDITOR=vim xterm+  $ env EDITOR=vim xterm [Entrée]
  
 ====1.16 - Options du Shell Bash==== ====1.16 - Options du Shell Bash====
Ligne 1109: Ligne 1181:
  
 <code> <code>
-[trainee@centos8 ~]$ set -o +trainee@debian11:~$ set -o 
-allexport       off +allexport       off 
-braceexpand     on +braceexpand     on 
-emacs           on +emacs           on 
-errexit         off +errexit         off 
-errtrace       off +errtrace        off 
-functrace       off +functrace       off 
-hashall         on +hashall         on 
-histexpand     on +histexpand      on 
-history         on +history         on 
-ignoreeof       off +ignoreeof       off 
-interactive-comments on +interactive-comments    on 
-keyword         off +keyword         off 
-monitor         on +monitor         on 
-noclobber       off +noclobber       off 
-noexec         off +noexec          off 
-noglob         off +noglob          off 
-nolog           off +nolog           off 
-notify         off +notify          off 
-nounset         off +nounset         off 
-onecmd         off +onecmd          off 
-physical       off +physical        off 
-pipefail       off +pipefail        off 
-posix           off +posix           off 
-privileged     off +privileged      off 
-verbose         off +verbose         off 
-vi             off +vi              off 
-xtrace         off+xtrace          off
 </code> </code>
  
Ligne 1142: Ligne 1214:
  
 <code> <code>
-[trainee@centos8 ~]$ set -o allexport +trainee@debian11:~$ set -o allexport 
-[trainee@centos8 ~]$ set -o + 
-allexport       on +trainee@debian11:~$ set -o | head 
-braceexpand     on +allexport       on 
-...+braceexpand     on 
 +emacs           on 
 +errexit         off 
 +errtrace        off 
 +functrace       off 
 +hashall         on 
 +histexpand      on 
 +history         on 
 +ignoreeof       off
 </code> </code>
  
Ligne 1156: Ligne 1236:
  
 <code> <code>
-[trainee@centos8 ~]$ set +o allexport +trainee@debian11:~$ set +o allexport 
-[trainee@centos8 ~]$ set -o + 
-allexport       off +trainee@debian11:~$ set -o | head 
-braceexpand     on +allexport       off 
-...+braceexpand     on 
 +emacs           on 
 +errexit         off 
 +errtrace        off 
 +functrace       off 
 +hashall         on 
 +histexpand      on 
 +history         on 
 +ignoreeof       off
 </code> </code>
  
Ligne 1180: Ligne 1268:
  
 <code> <code>
-[trainee@centos8 ~]$ set -o noclobber +trainee@debian11:~$ set -o noclobber 
-[trainee@centos8 ~]$ pwd > file + 
--bashfile: cannot overwrite existing file +trainee@debian11:~$ pwd > file
-[trainee@centos8 ~]$ pwd > file+
 -bash: file: cannot overwrite existing file -bash: file: cannot overwrite existing file
-[trainee@centos8 ~]$ pwd >| file + 
-[trainee@centos8 ~]$ set +o noclobber+trainee@debian11:~$ pwd >| file 
 + 
 +trainee@debian11:~$ cat file 
 +/home/trainee 
 + 
 +trainee@debian11:~$ set +o noclobber
 </code> </code>
  
-<WRAP center round important 60%>+<WRAP center round important>
 **Important** : Notez que l'option **noclobber** peut être contournée en utilisant la redirection suivi par le caractère **|**. **Important** : Notez que l'option **noclobber** peut être contournée en utilisant la redirection suivi par le caractère **|**.
 </WRAP> </WRAP>
Ligne 1196: Ligne 1288:
  
 <code> <code>
-[trainee@centos8 ~]$ set -o noglob +trainee@debian11:~$ set -o noglob 
-[trainee@centos8 ~]$ echo *+ 
 +trainee@debian11:~$ echo *
 * *
-[trainee@centos8 ~]$ set +o noglob +trainee@debian11:~$ set +o noglob 
-[trainee@centos8 ~]$ echo * + 
-aac abc bca codes Desktop Documents Downloads errorlog file file1 Music Pictures Public Templates training Videos vitext xyz+trainee@debian11:~$ echo * 
 +aac abc bca codes Desktop Documents Downloads errorlog file file1 file2 Music Pictures Public Templates training Videos vitext xyz
 </code> </code>
  
-<WRAP center round important 60%>+<WRAP center round important>
 **Important** : Notez que l'effet du caractère spécial est annulé sous l'influence de l'option **noglob**. **Important** : Notez que l'effet du caractère spécial est annulé sous l'influence de l'option **noglob**.
 </WRAP> </WRAP>
Ligne 1211: Ligne 1305:
  
 <code> <code>
-[trainee@centos8 ~]$ set -o nounset +trainee@debian11:~$ set -o nounset 
-[trainee@centos8 ~]$ echo $FENESTROS+ 
 +trainee@debian11:~$ echo $FENESTROS
 -bash: FENESTROS: unbound variable -bash: FENESTROS: unbound variable
-[trainee@centos8 ~]$ set +o nounset 
-[trainee@centos8 ~]$ echo $FENESTROS 
  
-[trainee@centos8 ~]+trainee@debian11:~$ set +o nounset 
 + 
 +trainee@debian11:~$ echo $FENESTROS 
 + 
 + 
 +trainee@debian11:~$
 </code> </code>
  
-<WRAP center round important 60%>+<WRAP center round important>
 **Important** : Notez que la variable inexistante **$FENESTROS** est identifiée comme telle sous l'influence de l'option **nounset**. Or le comportement habituel de Linux est de retourner une ligne vide qui n'indique pas si la variable n’existe pas ou si elle est simplement vide. **Important** : Notez que la variable inexistante **$FENESTROS** est identifiée comme telle sous l'influence de l'option **nounset**. Or le comportement habituel de Linux est de retourner une ligne vide qui n'indique pas si la variable n’existe pas ou si elle est simplement vide.
 </WRAP> </WRAP>
Ligne 1261: Ligne 1359:
  
 <code> <code>
-[trainee@centos8 ~]$ script +trainee@debian11:~$ script 
-Script started, file is typescript +Script started, output log file is 'typescript'. 
-[trainee@centos8 ~]$ pwd+ 
 +trainee@debian11:~$ pwd
 /home/trainee /home/trainee
-[trainee@centos8 ~]$ ls + 
-aac  abc  bca  codes  errorlog  file  file1  file2  training  typescript  xyz +trainee@debian11:~$ ls 
-[trainee@centos8 ~]$ exit+aac  bca    Desktop    Downloads  file   file2  Pictures  Templates  typescript  vitext 
 +abc  codes  Documents  errorlog   file1  Music  Public    training   Videos      xyz 
 + 
 +trainee@debian11:~$ exit
 exit exit
-Script done, file is typescript+Script done.
  
-[trainee@centos8 ~]$ cat typescript  +trainee@debian11:~$ cat typescript  
-Script started on 2021-04-20 10:59:58-04:00 +Script started on 2022-06-03 17:25:20+02:00 [TERM="xterm-256color" TTY="/dev/pts/1" COLUMNS="144" LINES="33"
-[trainee@centos8 ~]$ pwd+trainee@debian11:~$ pwd
 /home/trainee /home/trainee
-[trainee@centos8 ~]$ ls +trainee@debian11:~$ ls 
-aac  abc  bca  codes  errorlog  file  file1  file2  training  typescript  xyz +aac  bca    Desktop    Downloads  file   file2  Pictures  Templates  typescript  vitext 
-[trainee@centos8 ~]$ exit+abc  codes  Documents  errorlog   file1  Music  Public    training   Videos      xyz 
 +trainee@debian11:~$ exit
 exit exit
  
-Script done on 2021-04-20 11:00:09-04:00+Script done on 2022-06-03 17:25:32+02:00 [COMMAND_EXIT_CODE="0"]
 </code> </code>
  
Ligne 1288: Ligne 1391:
  
 <code> <code>
-[trainee@centos8 ~]$ vi myscript +trainee@debian11:~$ vi myscript 
-[trainee@centos8 ~]$ cat myscript+ 
 +trainee@debian11:~$ cat myscript
 pwd pwd
 ls ls
 +
 +trainee@debian11:~$
 </code> </code>
  
Ligne 1297: Ligne 1403:
  
 <code> <code>
-[trainee@centos8 ~]$ /bin/bash myscript+trainee@debian11:~$ /bin/bash myscript
 /home/trainee /home/trainee
-aac  bca    errorlog  file1  myscript  typescript +aac  bca    Desktop    Downloads  file   file2  myscript  Public     training    Videos  xyz 
-abc  codes  file      file2  training  xyz+abc  codes  Documents  errorlog   file1  Music  Pictures  Templates  typescript  vitext
 </code> </code>
  
Ligne 1306: Ligne 1412:
  
 <code> <code>
-[trainee@centos8 ~]$ /bin/bash < myscript+trainee@debian11:~$ /bin/bash < myscript
 /home/trainee /home/trainee
-aac  bca    errorlog  file1  myscript  typescript +aac  bca    Desktop    Downloads  file   file2  myscript  Public     training    Videos  xyz 
-abc  codes  file      file2  training  xyz+abc  codes  Documents  errorlog   file1  Music  Pictures  Templates  typescript  vitext
 </code> </code>
  
Ligne 1315: Ligne 1421:
  
 <code> <code>
-[trainee@centos8 ~]$ echo $PATH +trainee@debian11:~$ echo $PATH 
-/home/trainee/.local/bin:/home/trainee/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin+/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
 </code> </code>
  
-Dans le cas de RHEL/CentOS, même si PATH contient $HOME/bin, le répertoire n'existe pas :+Dans le cas de Debian 11 ceci n'est pas le cas. La raison pour ceci devient évidente en regardant le fichier **.profile** dans **/home/trainee** :
  
 <code> <code>
-[trainee@centos8 ~]$ ls +trainee@debian11:~$ cat .profile 
-aac  bca    errorlog  file1  myscript  typescript +# ~/.profile: executed by the command interpreter for login shells. 
-abc  codes  file      file2  training  xyz+# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login 
 +# exists. 
 +# see /usr/share/doc/bash/examples/startup-files for examples. 
 +# the files are located in the bash-doc package. 
 + 
 +# the default umask is set in /etc/profile; for setting the umask 
 +# for ssh logins, install and configure the libpam-umask package. 
 +#umask 022 
 + 
 +# if running bash 
 +if [ -n "$BASH_VERSION" ]; then 
 +    # include .bashrc if it exists 
 +    if [ -f "$HOME/.bashrc" ]; then 
 +        . "$HOME/.bashrc" 
 +    fi 
 +fi 
 + 
 +# set PATH so it includes user's private bin if it exists 
 +if [ -d "$HOME/bin" ] ; then 
 +    PATH="$HOME/bin:$PATH" 
 +fi 
 + 
 +# set PATH so it includes user's private bin if it exists 
 +if [ -d "$HOME/.local/bin" ] ; then 
 +    PATH="$HOME/.local/bin:$PATH" 
 +fi
 </code> </code>
  
-Créez donc ce répertoire :+Comme on peut constater, la valeur de PATH ne contiendra $HOME/bin que dans le cas où le répertoire existe : 
 + 
 +<file> 
 +... 
 +# set PATH so it includes user's private bin if it exists 
 +if [ -d "$HOME/bin" ] ; then 
 +    PATH="$HOME/bin:$PATH" 
 +fi 
 +... 
 +</file> 
 + 
 +Pour modifier la valeur de PATH, créez le répertoire **$HOME/bin** et rechargez le fichier **.profile** :
  
 <code> <code>
-[trainee@centos8 ~]$ mkdir bin+trainee@debian11:~$ mkdir bin 
 + 
 +trainee@debian11:~$ source .profile 
 + 
 +trainee@debian11:~$ echo $PATH 
 +/home/trainee/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
 </code> </code>
  
Ligne 1336: Ligne 1483:
  
 <code> <code>
-[trainee@centos8 ~]$ mv myscript ~/bin +trainee@debian11:~$ mv myscript ~/bin 
-[trainee@centos8 ~]$ chmod u+x ~/bin/myscript+ 
 +trainee@debian11:~$ chmod u+x ~/bin/myscript
 </code> </code>
  
Ligne 1343: Ligne 1491:
  
 <code> <code>
-[trainee@centos8 ~]$ cd /tmp +trainee@debian11:~$ cd /tmp 
-[trainee@centos8 tmp]$ myscript+ 
 +trainee@debian11:/tmp$ myscript
 /tmp /tmp
-expand +expand      filepartad      newfile    ssh-xO6PQly4PEcb 
-expand1 +expand1     filepartae      sales.awk  systemd-private-850c80cdbc444b4d9c7cb40b48706231-colord.service-Y3B8Jg 
-filepartaa +expand2     greptest        sales.txt  systemd-private-850c80cdbc444b4d9c7cb40b48706231-ModemManager.service-LrTCFg 
-filepartab +filepartaa  greptest1       scriptawk  systemd-private-850c80cdbc444b4d9c7cb40b48706231-systemd-logind.service-KILQOi 
-filepartac +filepartab  greptest.patch  sedtest    systemd-private-850c80cdbc444b4d9c7cb40b48706231-systemd-timesyncd.service-it6W3i 
-filepartad +filepartac  inode           sedtest1   systemd-private-850c80cdbc444b4d9c7cb40b48706231-upower.service-mPN3Xg
-filepartae +
-greptest +
-greptest1 +
-greptest.patch +
-newfile +
-sales.awk +
-sales.txt +
-scriptawk +
-sedtest +
-sedtest1 +
-systemd-private-d9ff2376a8a44f0392f860d80c839be4-chronyd.service-6im4Ii+
 </code> </code>
  
Ligne 1368: Ligne 1506:
  
 <code> <code>
-[trainee@centos8 tmp]$ cd ~/bin +trainee@debian11:/tmp$ cd ~/bin 
-[trainee@centos8 bin]$ ./myscript+ 
 +trainee@debian11:~/bin$ ./myscript
 /home/trainee/bin /home/trainee/bin
 myscript myscript
-[trainee@centos8 bin]$ . myscript+ 
 +trainee@debian11:~/bin$ . myscript
 /home/trainee/bin /home/trainee/bin
 myscript myscript
 </code> </code>
  
-<WRAP center round todo 60%>+<WRAP center round todo>
 **A faire** : Notez bien la différence entre les sorties de cette dernière commande et la précédente. Expliquez pourquoi. **A faire** : Notez bien la différence entre les sorties de cette dernière commande et la précédente. Expliquez pourquoi.
 </WRAP> </WRAP>
Ligne 1386: Ligne 1526:
  
 <code> <code>
-[trainee@centos8 bin]$ read var1 var2 var3 var4+trainee@debian11:~/bin$ read var1 var2 var3 var4
 fenestros edu is great! fenestros edu is great!
-[trainee@centos8 bin]$ echo $var1+ 
 +trainee@debian11:~/bin$ echo $var1
 fenestros fenestros
-[trainee@centos8 bin]$ echo $var2+ 
 +trainee@debian11:~/bin$ echo $var2
 edu edu
-[trainee@centos8 bin]$ echo $var3+ 
 +trainee@debian11:~/bin$ echo $var3
 is is
-[trainee@centos8 bin]$ echo $var4+ 
 +trainee@debian11:~/bin$ echo $var4
 great! great!
 </code> </code>
  
-<WRAP center round important 60%>+<WRAP center round important>
 **Important**: Notez que chaque champs a été placé dans une variable différente. Notez aussi que par convention les variables déclarées par des utilisateurs sont en miniscules afin de les distinguer des variables système qui sont en majuscules. **Important**: Notez que chaque champs a été placé dans une variable différente. Notez aussi que par convention les variables déclarées par des utilisateurs sont en miniscules afin de les distinguer des variables système qui sont en majuscules.
 </WRAP> </WRAP>
  
 <code> <code>
-[trainee@centos8 bin]$ read var1 var2+trainee@debian11:~/bin$ read var1 var2
 fenestros edu is great! fenestros edu is great!
-[trainee@centos8 bin]$ echo $var1+ 
 +trainee@debian11:~/bin$ echo $var1
 fenestros fenestros
-[trainee@centos8 bin]$ echo $var2+ 
 +trainee@debian11:~/bin$ echo $var2
 edu is great! edu is great!
 </code> </code>
  
-<WRAP center round important 60%>+<WRAP center round important>
 **Important** : Notez que dans le deuxième cas, le reste de la ligne après le mot //fenestros// est mis dans **$var2**. **Important** : Notez que dans le deuxième cas, le reste de la ligne après le mot //fenestros// est mis dans **$var2**.
 </WRAP> </WRAP>
Ligne 1420: Ligne 1566:
  
 <code> <code>
-[trainee@centos8 bin]$ read var+trainee@debian11:~/bin$ read var
 </code> </code>
 <key>Entrée</key> <key>Entrée</key>
 <code> <code>
-[trainee@centos8 bin]$ echo $?+trainee@debian11:~/bin$ echo $?
 0 0
-[trainee@centos8 bin]$ echo $var 
  
-[trainee@centos8 bin]+trainee@debian11:~/bin$ echo $var 
 + 
 + 
 +trainee@debian11:~/bin$ 
 </code> </code>
  
Ligne 1434: Ligne 1582:
  
 <code> <code>
-[trainee@centos8 bin]$ read var+trainee@debian11:~/bin$ read var
 </code> </code>
 <key>C-d</key> <key>C-d</key>
 <code> <code>
-[trainee@centos8 bin]$ echo $?+trainee@debian11:~/bin$ echo $?
 1 1
-[trainee@centos8 bin]$ echo $var 
  
-[trainee@centos8 bin]+trainee@debian11:~/bin$ echo $var 
 + 
 + 
 +trainee@debian11:~/bin$ 
 </code> </code>
  
Ligne 1450: Ligne 1600:
  
 <code> <code>
-[trainee@centos8 bin]$ echo "$IFS" | od -c+trainee@debian11:~/bin$ echo "$IFS" | od -c
 0000000      \t  \n  \n 0000000      \t  \n  \n
 0000004 0000004
 </code> </code>
  
-<WRAP center round important 60%>+<WRAP center round important>
 **Important** : La commande **od** (//Octal Dump//) renvoie le contenu d'un fichier ou de l'entrée standard au format octal. Ceci est utile afin de visualiser les caractères non-imprimables. L'option **-c** permet de sélectionner des caractères ASCII ou des backslash dans le fichier ou dans le contenu fourni à l'entrée standard. **Important** : La commande **od** (//Octal Dump//) renvoie le contenu d'un fichier ou de l'entrée standard au format octal. Ceci est utile afin de visualiser les caractères non-imprimables. L'option **-c** permet de sélectionner des caractères ASCII ou des backslash dans le fichier ou dans le contenu fourni à l'entrée standard.
 </WRAP> </WRAP>
Ligne 1462: Ligne 1612:
  
 <code> <code>
-[trainee@centos8 bin]$ OLDIFS="$IFS" +trainee@debian11:~/bin$ OLDIFS="$IFS" 
-[trainee@centos8 bin]$ IFS=":" + 
-[trainee@centos8 bin]$ echo "$IFS" | od -c+trainee@debian11:~/bin$ IFS=":" 
 + 
 +trainee@debian11:~/bin$ echo "$IFS" | od -c
 0000000   :  \n 0000000   :  \n
 0000002 0000002
Ligne 1472: Ligne 1624:
  
 <code> <code>
-[trainee@centos8 bin]$ read var1 var2 var3+trainee@debian11:~/bin$ read var1 var2 var3
 fenestros:edu is:great! fenestros:edu is:great!
-[trainee@centos8 bin]$ echo $var1+ 
 +trainee@debian11:~/bin$ echo $var1
 fenestros fenestros
-[trainee@centos8 bin]$ echo $var2+ 
 +trainee@debian11:~/bin$ echo $var2
 edu is edu is
-[trainee@centos8 bin]$ echo $var3+ 
 +trainee@debian11:~/bin$ echo $var3
 great! great!
 </code> </code>
Ligne 1485: Ligne 1640:
  
 <code> <code>
-[trainee@centos8 bin]$ IFS="$OLDIFS" +trainee@debian11:~/bin$ IFS="$OLDIFS" 
-[trainee@centos8 bin]$ echo "$IFS" | od -c+ 
 +trainee@debian11:~/bin$ echo "$IFS" | od -c
 0000000      \t  \n  \n 0000000      \t  \n  \n
 0000004 0000004
Ligne 1519: Ligne 1675:
  
 <code> <code>
-[trainee@centos8 bin]$ cd ../training/ +trainee@debian11:~/bin$ cd ../training/ 
-[trainee@centos8 training]$ test -f a100 + 
-[trainee@centos8 training]$ echo $? +trainee@debian11:~/training$ test -f a100 
 + 
 +trainee@debian11:~/training$ echo $?
 0 0
-[trainee@centos8 training]$ [ -f a100 ] + 
-[trainee@centos8 training]$ echo $? +trainee@debian11:~/training$ [ -f a100 ] 
 + 
 +trainee@debian11:~/training$ echo $?
 0 0
 </code> </code>
Ligne 1531: Ligne 1691:
  
 <code> <code>
-[trainee@centos8 training]$ [ -f a101 ] +trainee@debian11:~/training$ [ -f a101 ] 
-[trainee@centos8 training]$ echo $?+ 
 +trainee@debian11:~/training$ echo $?
 1 1
 </code> </code>
Ligne 1539: Ligne 1700:
  
 <code> <code>
-[trainee@centos8 training]$ [ -d /home/trainee/training ] +trainee@debian11:~/training$ [ -d /home/trainee/training ] 
-[trainee@centos8 training]$ echo $?+ 
 +trainee@debian11:~/training$ echo $?
 0 0
 </code> </code>
Ligne 1556: Ligne 1718:
  
 <code> <code>
-[trainee@centos8 training]$ string1="root" +trainee@debian11:~/training$ string1="root" 
-[trainee@centos8 training]$ string2="fenestros" + 
-[trainee@centos8 training]$ [ $string1 = $string2 ] +trainee@debian11:~/training$ string2="fenestros" 
-[trainee@centos8 training]$ echo $?+ 
 +trainee@debian11:~/training$ [ $string1 = $string2 ] 
 + 
 +trainee@debian11:~/training$ echo $?
 1 1
 </code> </code>
Ligne 1566: Ligne 1731:
  
 <code> <code>
-[trainee@centos8 training]$ [ -n $string1 ] +trainee@debian11:~/training$ [ -n $string1 ] 
-[trainee@centos8 training]$ echo $?+ 
 +trainee@debian11:~/training$ echo $?
 0 0
 </code> </code>
Ligne 1574: Ligne 1740:
  
 <code> <code>
-[trainee@centos8 training]$ [ -z $string1 ] +trainee@debian11:~/training$ [ -z $string1 ] 
-[trainee@centos8 training]$ echo $?+ 
 +trainee@debian11:~/training$ echo $?
 1 1
 </code> </code>
Ligne 1592: Ligne 1759:
  
 <code> <code>
-[trainee@centos8 training]$ read value1+trainee@debian11:~/training$ read value1
 35 35
-[trainee@centos8 training]$ read value2+ 
 +trainee@debian11:~/training$ read value2
 23 23
-[trainee@centos8 training]$ [ $value1 -lt $value2 ] + 
-[trainee@centos8 training]$ echo $?+trainee@debian11:~/training$ [ $value1 -lt $value2 ] 
 + 
 +trainee@debian11:~/training$ echo $?
 1 1
-[trainee@centos8 training]$ [ $value2 -lt $value1 ] + 
-[trainee@centos8 training]$ echo $?+trainee@debian11:~/training$ [ $value2 -lt $value1 ] 
 + 
 +trainee@debian11:~/training$ echo $?
 0 0
-[trainee@centos8 training]$ [ $value2 -eq $value1 ] + 
-[trainee@centos8 training]$ echo $?+trainee@debian11:~/training$ [ $value2 -eq $value1 ] 
 + 
 +trainee@debian11:~/training$ echo $?
 1 1
 </code> </code>
Ligne 1618: Ligne 1792:
  
 <code> <code>
-[trainee@centos8 training]$ file=a1OO +trainee@debian11:~/training$ file=a1OO 
-[trainee@centos8 training]$ [ ! -d $file ] + 
-[trainee@centos8 training]$ echo $?+trainee@debian11:~/training$ [ ! -d $file ] 
 + 
 +trainee@debian11:~/training$ echo $?
 0 0
 </code> </code>
Ligne 1627: Ligne 1803:
  
 <code> <code>
-[trainee@centos8 training]$ directory=/usr +trainee@debian11:~/training$ directory=/usr 
-[trainee@centos8 training]$ [ -d $directory -a -x $directory ] + 
-[trainee@centos8 training]$ echo $?+trainee@debian11:~/training$ [ -d $directory -a -x $directory ] 
 + 
 +trainee@debian11:~/training$ echo $?
 0 0
 </code> </code>
Ligne 1636: Ligne 1814:
  
 <code> <code>
-[trainee@centos8 training]$ [ -w a100 -a \( -d /usr -o -d /tmp \) ] +trainee@debian11:~/training$ [ -w a100 -a \( -d /usr -o -d /tmp \) ] 
-[trainee@centos8 training]$ echo $?+ 
 +trainee@debian11:~/training$ echo $?
 0 0
 </code> </code>
Ligne 1647: Ligne 1826:
  
 <code> <code>
-[trainee@centos8 training]$ [ -o allexport ] +trainee@debian11:~/training$ [ -o allexport ] 
-[trainee@centos8 training]$ echo $?+ 
 +trainee@debian11:~/training$ echo $?
 1 1
 </code> </code>
Ligne 1673: Ligne 1853:
  
 <code> <code>
-[trainee@centos8 training]$ [[ -w a100 && ( -d /usr || -d /tmp ) ]] +trainee@debian11:~/training$ [[ -w a100 && ( -d /usr || -d /tmp ) ]] 
-[trainee@centos8 training]$ echo $?+ 
 +trainee@debian11:~/training$ echo $?
 0 0
 </code> </code>
Ligne 1685: Ligne 1866:
  
 <code> <code>
-[trainee@centos8 training]$ [[ -d /root ]] && echo "The root directory exists"+trainee@debian11:~/training$ [[ -d /root ]] && echo "The root directory exists"
 The root directory exists The root directory exists
-[trainee@centos8 training]$ [[ -d /root ]] || echo "The root directory exists" + 
-[trainee@centos8 training]$  +trainee@debian11:~/training$ [[ -d /root ]] || echo "The root directory exists" 
 +trainee@debian11:~/training$  
 </code> </code>
  
Ligne 1740: Ligne 1922:
  
 <code> <code>
-[trainee@centos8 training]$ x=2 +trainee@debian11:~/training$ x=2 
-[trainee@centos8 training]$ expr $x + 2+ 
 +trainee@debian11:~/training$ expr $x + 2
 4 4
 </code> </code>
Ligne 1748: Ligne 1931:
  
 <code> <code>
-[trainee@centos8 training]$ expr $x+2+trainee@debian11:~/training$ expr $x+2
 2+2 2+2
 </code> </code>
Ligne 1755: Ligne 1938:
  
 <code> <code>
-[trainee@centos8 training]$ expr $x * 2 +trainee@debian11:~/training$ expr $x * 2 
-expr: syntax error +expr: syntax error: unexpected argument ‘a100’ 
-[trainee@centos8 training]$ expr $x \* 2+ 
 +trainee@debian11:~/training$ expr $x \* 2
 4 4
 </code> </code>
Ligne 1764: Ligne 1948:
  
 <code> <code>
-[trainee@centos8 training]resultat=`expr $x + 10` +trainee@debian11:~/training$ result=`expr $x + 10` 
-[trainee@centos8 training]$ echo $resultat+ 
 +trainee@debian11:~/training$ echo $result
 12 12
 </code> </code>
Ligne 1818: Ligne 2003:
  
 <code> <code>
-[trainee@centos8 training]$ x=2 +trainee@debian11:~/training$ x=2 
-[trainee@centos8 training]$ ((x=$x+10)) + 
-[trainee@centos8 training]$ echo $x+trainee@debian11:~/training$ ((x=$x+10)) 
 + 
 +trainee@debian11:~/training$ echo $x
 12 12
-[trainee@centos8 training]$ ((x=$x+20)) + 
-[trainee@centos8 training]$ echo $x+trainee@debian11:~/training$ ((x=$x+20)) 
 + 
 +trainee@debian11:~/training$ echo $x
 32 32
 </code> </code>
Ligne 1873: Ligne 2062:
  
 <code> <code>
-[trainee@centos8 training]$ vi user_check +trainee@debian11:~/training$ vi user_check 
-[trainee@centos8 training]$ cat user_check+ 
 +trainee@debian11:~/training$ cat user_check
 #!/bin/bash #!/bin/bash
 if [ $# -ne 1 ] ; then if [ $# -ne 1 ] ; then
Ligne 1893: Ligne 2083:
  
 <code> <code>
-[trainee@centos8 training]$ chmod 770 user_check +trainee@debian11:~/training$ chmod 770 user_check 
-[trainee@centos8 training]$ ./user_check+ 
 +trainee@debian11:~/training$ ./user_check 
 Mauvais nombre d'arguments Mauvais nombre d'arguments
 Usage : ./user_check nom_utilisateur Usage : ./user_check nom_utilisateur
-[trainee@centos8 training]$ ./user_check root+ 
 +trainee@debian11:~/training$ ./user_check root
 Utilisateur root est défini sur ce système Utilisateur root est défini sur ce système
-[trainee@centos8 training]$ ./user_check mickey mouse+ 
 +trainee@debian11:~/training$ ./user_check mickey mouse
 Mauvais nombre d'arguments Mauvais nombre d'arguments
 Usage : ./user_check nom_utilisateur Usage : ./user_check nom_utilisateur
-[trainee@centos8 training]$ ./user_check "mickey mouse"+ 
 +trainee@debian11:~/training$ ./user_check "mickey mouse"
 Utilisateur mickey mouse n'est pas défini sur ce système Utilisateur mickey mouse n'est pas défini sur ce système
 </code> </code>
Ligne 1947: Ligne 2141:
 </code> </code>
  
-<WRAP center round important 60%>+<WRAP center round important>
 **Important** : L'exemple indique que dans le cas où le premier argument qui suit le nom du script contenant la clause **case** est **start**, la fonction //start// sera exécutée. La fonction //start// n'a pas besoin d'être définie dans **case** et est donc en règle générale définie en début de script. La même logique est appliquée dans le cas où le premier argument est **stop**, **restart** ou **reload** et **status**. Dans tous les autres cas, représentés par une étoile, **case** affichera la ligne **Usage: $0 {start|stop|restart|status}** où $0 est remplacé par le nom du script. **Important** : L'exemple indique que dans le cas où le premier argument qui suit le nom du script contenant la clause **case** est **start**, la fonction //start// sera exécutée. La fonction //start// n'a pas besoin d'être définie dans **case** et est donc en règle générale définie en début de script. La même logique est appliquée dans le cas où le premier argument est **stop**, **restart** ou **reload** et **status**. Dans tous les autres cas, représentés par une étoile, **case** affichera la ligne **Usage: $0 {start|stop|restart|status}** où $0 est remplacé par le nom du script.
 </WRAP> </WRAP>
Ligne 1989: Ligne 2183:
 </file> </file>
  
-====2.- Scripts de Démarrage====+====2.- Scripts de Démarrage====
  
 Quand Bash est appelé en tant que shell de connexion, il exécute des scripts de démarrage dans l'ordre suivant : Quand Bash est appelé en tant que shell de connexion, il exécute des scripts de démarrage dans l'ordre suivant :
Ligne 1996: Ligne 2190:
   * **~/.bash_profile** ou **~/.bash_login** ou **~/.profile** selon la distribution,   * **~/.bash_profile** ou **~/.bash_login** ou **~/.profile** selon la distribution,
  
-Dans le cas de RHEL/CentOS, le système exécute le fichier **~/.bash_profile**.+Dans le cas de Debian 11 le système exécute le fichier **~/.profile**
  
 Quand un shell de login se termine, Bash exécute le fichier **~/.bash_logout** si celui-ci existe. Quand un shell de login se termine, Bash exécute le fichier **~/.bash_logout** si celui-ci existe.
Ligne 2002: Ligne 2196:
 Quand bash est appelé en tant que shell interactif qui n'est pas un shell de connexion, il exécute le script **~/.bashrc**. Quand bash est appelé en tant que shell interactif qui n'est pas un shell de connexion, il exécute le script **~/.bashrc**.
  
-<WRAP center round important 60%>+<WRAP center round important>
 **A faire** : En utilisant vos connaissances acquises dans ce module, expliquez les scripts suivants ligne par ligne.  **A faire** : En utilisant vos connaissances acquises dans ce module, expliquez les scripts suivants ligne par ligne. 
 </WRAP> </WRAP>
  
-===~/.bash_profile===+===~/.profile===
  
 <code> <code>
-[trainee@centos8 training]$ cat ~/.bash_profile +trainee@debian11:~/training$ cat ~/.profile 
-# .bash_profile+~/.profile: executed by the command interpreter for login shells. 
 +# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login 
 +# exists. 
 +# see /usr/share/doc/bash/examples/startup-files for examples. 
 +# the files are located in the bash-doc package.
  
-Get the aliases and functions +# the default umask is set in /etc/profile; for setting the umask 
-if [ -f ~/.bashrc ]; then +# for ssh logins, install and configure the libpam-umask package. 
-~/.bashrc+#umask 022 
 + 
 +# if running bash 
 +if [ -n "$BASH_VERSION" ]; then 
 +    # include .bashrc if it exists 
 +    if [ -f "$HOME/.bashrc]; then 
 +        "$HOME/.bashrc
 +    fi
 fi fi
  
-User specific environment and startup programs+set PATH so it includes user's private bin if it exists 
 +if [ -d "$HOME/bin" ] ; then 
 +    PATH="$HOME/bin:$PATH" 
 +fi 
 + 
 +# set PATH so it includes user's private bin if it exists 
 +if [ -d "$HOME/.local/bin" ] ; then 
 +    PATH="$HOME/.local/bin:$PATH" 
 +fi
 </code> </code>
  
Ligne 2023: Ligne 2236:
  
 <code> <code>
-[trainee@centos8 training]$ cat ~/.bashrc +trainee@debian11:~/training$ cat ~/.bashrc 
-# .bashrc+~/.bashrc: executed by bash(1) for non-login shells. 
 +# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) 
 +# for examples
  
-Source global definitions +If not running interactively, don't do anything 
-if [ -/etc/bashrc ]; then +case $- in 
- /etc/bashrc+    *i*) ;; 
 +      *) return;; 
 +esac 
 + 
 +# don't put duplicate lines or lines starting with space in the history. 
 +# See bash(1) for more options 
 +HISTCONTROL=ignoreboth 
 + 
 +# append to the history file, don't overwrite it 
 +shopt -s histappend 
 + 
 +# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) 
 +HISTSIZE=1000 
 +HISTFILESIZE=2000 
 + 
 +# check the window size after each command and, if necessary, 
 +# update the values of LINES and COLUMNS. 
 +shopt -s checkwinsize 
 + 
 +# If set, the pattern "**" used in a pathname expansion context will 
 +# match all files and zero or more directories and subdirectories. 
 +#shopt -s globstar 
 + 
 +# make less more friendly for non-text input files, see lesspipe(1) 
 +#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" 
 + 
 +# set variable identifying the chroot you work in (used in the prompt below) 
 +if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then 
 +    debian_chroot=$(cat /etc/debian_chroot)
 fi fi
  
-User specific environment +set a fancy prompt (non-color, unless we know we "want" color) 
-PATH="$HOME/.local/bin:$HOME/bin:$PATH+case "$TERMin 
-export PATH+    xterm-color|*-256color) color_prompt=yes;; 
 +esac
  
-Uncomment the following line if you don't like systemctl's auto-paging feature+uncomment for a colored prompt, if the terminal has the capability; turned 
-export SYSTEMD_PAGER=+# off by default to not distract the userthe focus in a terminal window 
 +# should be on the output of commands, not on the prompt 
 +#force_color_prompt=yes
  
-User specific aliases and functions+if [ -n "$force_color_prompt" ]; then 
 +    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then 
 +        We have color support; assume it's compliant with Ecma-48 
 +        # (ISO/IEC-6429). (Lack of such support is extremely rare, and such 
 +        # a case would tend to support setf rather than setaf.) 
 +        color_prompt=yes 
 +    else 
 +        color_prompt= 
 +    fi 
 +fi 
 + 
 +if [ "$color_prompt" = yes ]; then 
 +    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' 
 +else 
 +    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' 
 +fi 
 +unset color_prompt force_color_prompt 
 + 
 +# If this is an xterm set the title to user@host:dir 
 +case "$TERM" in 
 +xterm*|rxvt*) 
 +    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" 
 +    ;; 
 +*) 
 +    ;; 
 +esac 
 + 
 +# enable color support of ls and also add handy aliases 
 +if [ -x /usr/bin/dircolors ]; then 
 +    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" 
 +    alias ls='ls --color=auto' 
 +    #alias dir='dir --color=auto' 
 +    #alias vdir='vdir --color=auto' 
 + 
 +    #alias grep='grep --color=auto' 
 +    #alias fgrep='fgrep --color=auto' 
 +    #alias egrep='egrep --color=auto' 
 +fi 
 + 
 +# colored GCC warnings and errors 
 +#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' 
 + 
 +# some more ls aliases 
 +#alias ll='ls -l' 
 +#alias la='ls -A' 
 +#alias l='ls -CF' 
 + 
 +# Alias definitions. 
 +# You may want to put all your additions into a separate file like 
 +# ~/.bash_aliases, instead of adding them here directly. 
 +# See /usr/share/doc/bash-doc/examples in the bash-doc package. 
 + 
 +if [ -f ~/.bash_aliases ]; then 
 +    . ~/.bash_aliases 
 +fi 
 + 
 +# enable programmable completion features (you don't need to enable 
 +# this, if it's already enabled in /etc/bash.bashrc and /etc/profile 
 +# sources /etc/bash.bashrc). 
 +if ! shopt -oq posix; then 
 +  if [ -f /usr/share/bash-completion/bash_completion ]; then 
 +    . /usr/share/bash-completion/bash_completion 
 +  elif [ -f /etc/bash_completion ]; then 
 +    . /etc/bash_completion 
 +  fi 
 +fi
 </code> </code>
  
 ----- -----
-Copyright © 2022 Hugh Norris.+ 
 +Copyright © 2024 Hugh Norris.
Menu