TP LPIC No 5
Exercice 1 :
- Afficher le format du prompt
echo $PS1
- Modifier le Prompt pour qu'il devient de la forme « compte – nom de la machine »
- Afficher le prompt2
echo $PS2
- Mettre dans la variable '@'
- Créer le fichier « script.bash»

- rendre le fichier exécutable
chmod +x script.bash
- exécuter le script ./script.bash
- Déduire le rôle de « shift »
Exercice 2
Publicité
- Afficher le fichier script
- L'afficher à l'envers
- Afficher la première ligne du script (head)
- Afficher sa dernière ligne (tail)
- Afficher la deuxième ligne seulement (head et tail)
- Afficher le fichier /etc/passwd
- Afficher les shell des utilisateurs (cut, /etc/passwd)
- Ordonner les shells existant (sort)
- Afficher les shells sans redondance (uniq)
- Afficher le script en numérotant ses lignes (nl)
- Combien de lignes compte le fichier script (wc)
- Combien de caractères compte le fichier script (wc)
- Combien de mots compte le fichier script (wc)
Exercice 3
Which of the following commands is implemented as an internal command in bash?
A. cat
B. less
C. tee
D. sed
E. echo
You type echo $PROC , and the computer replies Go away. What does this mean?
A. No currently running processes are associated with your shell, so you may log out
without terminating them.
B. The remote computer PROC isn’t accepting connections; you should contact its adminis-
Publicité
trator to correct the problem.
C. Your computer is handling too many processes; you must kill some of them to regain
control of the computer.
D. Your central processing unit (CPU) is defective and must be replaced as soon as pos-
sible.
E. You, one of your configuration files, or a program you’ve run has set the $PROC envi-
ronment variable to Go away.
How does man display information by default on most Linux systems?
A. Using a custom X-based application
B. Using the Firefox Web browser
C. Using the info browser
D. Using the Vi editor
Publicité
E. Using the less pager
What program would you use to display the end of a configuration file?
A. uniq
B. cut
C. tail
D. wc
E. fmt
What is the effect of the following command?
$ pr report.txt | lpr
A. The file report.txt is formatted for printing and sent to the lpr program.
B. The files report.txt and lpr are combined together into one file and sent to standard
output.
Publicité
C. Tabs are converted to spaces in report.txt, and the result is saved in lpr.
D. The file report.txt is printed, and any error messages are stored in the file lpr.
E. None of the above.
Which of the following commands will number the lines in aleph.txt? (Select three.)
A. fmt aleph.txt
B. nl aleph.txt
C. cat -b aleph.txt
D. cat -n aleph.txt
E. od -nl aleph.txt