From 4f98f4f7709b70915d37314ac73f9c2e5920839e Mon Sep 17 00:00:00 2001 From: Chris Jesz Date: Thu, 29 Nov 2018 19:02:57 -0500 Subject: [PATCH] Create index.md (#22988) --- guide/english/bash/bash-tail/index.md | 53 ++++++++++++++++----------- 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/guide/english/bash/bash-tail/index.md b/guide/english/bash/bash-tail/index.md index 5e516139de..12fdc4a563 100644 --- a/guide/english/bash/bash-tail/index.md +++ b/guide/english/bash/bash-tail/index.md @@ -1,37 +1,46 @@ --- -title: Bash tail +title: Bash Tail --- -## Bash tail -Tail is a program to display the **tail** end of a text file. If no option is given, tail shows the last 10 lines of a given file. - + ## Bash Tail +`tail` is a program to display the **tail** end of a text file. If no option is given, tail shows the last 10 lines of a given file. + ### Usage ```bash tail [options] [file_names] ``` + +Commonly used options: -Most used options: - -* `-f`, display the last lines and then monitor the file. If new lines are added to the file, tail updates the display. -* `-c NUM`, display the last `NUM` bytes of the file. -* `-n NUM`, display the last `NUM` lines, instead of the last 10 - - -### Example - -To show the last 10 lines from file **log.txt** - -```bash -tail log.txt -``` -Show only the last line from file **log.txt** +- `-f` - Display the last lines and then monitor the file. If new lines are added to the file, tail updates the display. +- `-F` - Same as `-f` but if the file/log is rolled it will continue with the new file/log. +- `-c NUM` - display the last `NUM` bytes of the file. +- `-n NUM` - display the last `NUM` lines, instead of the last 10 + + ### Examples + + #### View the last several lines from file **log.txt** + ```bash + tail log.txt + ``` + + #### View the last 15 lines from file **log.txt** + ```bash + tail -n 15 log.txt + ``` + +#### Show only the last line from file **log.txt** ```bash tail -n1 log.txt ``` -Show live changes from file **log.txt** + + #### Show live changes from file **log.txt** ```bash tail -f log.txt ``` -#### More Information: -* Wikipedia: https://en.wikipedia.org/wiki/Tail_(Unix) + + ### More Information + * Run `man tail` for more information on the tail command as well as a complete list of options. + * [Wikipedia](https://en.wikipedia.org/wiki/Tail_(Unix)) + \ No newline at end of file