Reading files · Lire des fichiers
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version. · Cette page nécessite un navigateur récent (avec support SharedArrayBuffer). Veuillez mettre à jour Chrome, Edge, Firefox ou Safari vers la dernière version.
English
Reading a file
catprints a file's contents straight to the screen:
- It is named after "concatenate" — it can also join several files together.
Français
Lire un fichier
cataffiche le contenu d'un fichier directement sur l'écran :
cat poem.txt
- Il doit son nom à "concatenate" — il peut aussi joindre plusieurs fichiers ensemble.
English
Just the start or end
- For a long file you often want only a peek:
headshows the first lines,tailshows the last lines.
- The
-noption chooses how many lines.
Français
Juste le début ou la fin
- Pour un long fichier, vous voulez souvent juste un aperçu :
headaffiche les premières lignes,tailaffiche les dernières lignes.
head -n 2 poem.txt
tail -n 1 poem.txt
- L'option
-nchoisit combien de lignes afficher.
English
Counting
wc(word count) measures a file. The most useful option is-lfor lines:
wc -wcounts words andwc -ccounts characters. Now try the tasks.
Français
Compter
wc(word count) mesure un fichier. L'option la plus utile est-lpour les lignes :
wc -l poem.txt
wc -wcompte les mots etwc -ccompte les caractères. Maintenant essayez les exercices.
English
Common mistakes
catprints a whole file at once; uselessto scroll a large one.- Press Tab to complete a long file name.
Français
Erreurs courantes
cataffiche un fichier entier d'un coup ; utilisezlesspour faire défiler un grand fichier.- Appuyez sur Tab pour compléter un long nom de fichier.
Use cat to print the whole contents of poem.txt. · Utilisez cat pour afficher le contenu complet de poem.txt.
How many lines does the poem have? Use wc -l poem.txt to count them. · Combien de lignes contient ce poème ? Utilisez wc -l poem.txt pour les compter.