Projet DVD-MIAGE 2010
TP n°2 : Commandes UNIX (suite)
CORRECTION
Exercice 1 – La commande ls
Solution :
1) pas d'option
2) option a
3) option l
4) option R
5) options lt et ltr
6) option F
7) La commande file donne des indications sur le contenu du fichier (script shell, document
Open Office, fichier audio, etc.)
Exercice 2 – La commande grep
Solution :
1) grep ’cot$’ dico_francais.txt
2) grep ’ˆav.*t$’ dico_francais.txt
3) grep ’ˆ[ˆe]*a[ˆe]*a[ˆe]*$’ dico_francais.txt
Note : pour être rigoureux, il faudrait remplacer a par [aàâ] et e par [eéèêë].
4) grep ’ˆ[a-l].\{4\}$’ dico_francais.txt
ou grep ’ˆ[a-l]....$’ dico_francais.txt
5) grep -c ˆv dico_francais.txt
Exercice 3 – La commande find
Solution:
1) find . -mtime -3 -print
2) find . -mmin +20 -print
3) find . -type f -size +200k -print
4) find . -name dico_francais.txt -print
5) find /usr -type d -name bin -print
Systèmes d'exploitation A. Queudet