tail
tail [DRAPEAU]... [FICHIER]...
Afficher les 10 dernières lignes de chaque FICHIER sur la sortie standard. Avec plus d’un FICHIER, précéder chacun d’un en-tête donnant le nom du fichier. Sans FICHIER, ou quand FICHIER est -, lire l’entrée standard. Les arguments obligatoires pour les drapeaux longs sont également obligatoires pour les drapeaux courts.
Options
--bytes,-c-
Nombre d’octets à afficher
--follow,-f-
Afficher le fichier au fur et à mesure de sa croissance
--lines,-n-
Nombre de lignes à afficher
--pid=<PID>-
Avec -f, terminer après que l’ID de processus, PID meure
--quiet,--silent,-q-
Ne jamais afficher d’en-têtes donnant les noms de fichiers
--sleep-interval=<N>,-s <N>-
Nombre de secondes à attendre entre les sondages du fichier lors de l’exécution avec -f
--max-unchanged-stats=<N>-
Rouvrir un FICHIER qui n’a pas changé de taille après N (par défaut 5) itérations pour voir s’il a été supprimé ou renommé (c’est le cas habituel des fichiers journaux pivotés) ; Cette option n’a de sens que lors du sondage (c’est-à-dire avec –use-polling) et quand –follow=name
--verbose,-v-
Toujours afficher des en-têtes donnant les noms de fichiers
--zero-terminated,-z-
Le délimiteur de ligne est NUL, pas newline
--use-polling-
Désactiver le support ‘inotify’ et utiliser le sondage à la place
--retry-
Continuer d’essayer d’ouvrir un fichier s’il est inaccessible
-F-
Identique à –follow=name –retry
--debug-
indicate which –follow implementation is used
--presume-input-pipe
Examples
Show last 10 lines in a file:
tail {{path/to/file}}
Show last 10 lines of multiple files:
tail {{path/to/file1 path/to/file2 ...}}
Show last 5 lines in file:
tail {{[-5|--lines 5]}} {{path/to/file}}
Print a file from a specific line number:
tail {{[-n|--lines]}} +{{count}} {{path/to/file}}
Print a specific count of bytes from the end of a given file:
tail {{[-c|--bytes]}} {{count}} {{path/to/file}}
Print the last lines of a given file and keep reading it until <Ctrl c>:
tail {{[-f|--follow]}} {{path/to/file}}
Keep reading file until <Ctrl c>, even if the file is inaccessible:
tail {{[-F|--retry --follow]}} {{path/to/file}}
Show last count lines in a file and refresh every seconds seconds:
tail {{[-n|--lines]}} {{count}} {{[-s|--sleep-interval]}} {{seconds}} {{[-f|--follow]}} {{path/to/file}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.