Create index.md (#22988)
This commit is contained in:
committed by
Christopher McCormack
parent
8918f66f7e
commit
4f98f4f770
@ -1,9 +1,9 @@
|
|||||||
---
|
---
|
||||||
title: Bash tail
|
title: Bash Tail
|
||||||
---
|
---
|
||||||
|
|
||||||
## 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.
|
`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
|
### Usage
|
||||||
|
|
||||||
@ -11,27 +11,36 @@ Tail is a program to display the **tail** end of a text file. If no option is gi
|
|||||||
tail [options] [file_names]
|
tail [options] [file_names]
|
||||||
```
|
```
|
||||||
|
|
||||||
Most used options:
|
Commonly used options:
|
||||||
|
|
||||||
* `-f`, display the last lines and then monitor the file. If new lines are added to the file, tail updates the display.
|
- `-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.
|
- `-F` - Same as `-f` but if the file/log is rolled it will continue with the new file/log.
|
||||||
* `-n NUM`, display the last `NUM` lines, instead of the last 10
|
- `-c NUM` - display the last `NUM` bytes of the file.
|
||||||
|
- `-n NUM` - display the last `NUM` lines, instead of the last 10
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
|
||||||
### Example
|
#### View the last several lines from file **log.txt**
|
||||||
|
```bash
|
||||||
|
tail log.txt
|
||||||
|
```
|
||||||
|
|
||||||
To show the last 10 lines from file **log.txt**
|
#### View the last 15 lines from file **log.txt**
|
||||||
|
```bash
|
||||||
|
tail -n 15 log.txt
|
||||||
|
```
|
||||||
|
|
||||||
```bash
|
#### Show only the last line from file **log.txt**
|
||||||
tail log.txt
|
|
||||||
```
|
|
||||||
Show only the last line from file **log.txt**
|
|
||||||
```bash
|
```bash
|
||||||
tail -n1 log.txt
|
tail -n1 log.txt
|
||||||
```
|
```
|
||||||
Show live changes from file **log.txt**
|
|
||||||
|
#### Show live changes from file **log.txt**
|
||||||
```bash
|
```bash
|
||||||
tail -f log.txt
|
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))
|
||||||
|
|
Reference in New Issue
Block a user