Copied to clipboard


`tail` is a command line tool used to view the end of a file. It is often used to view the end of log files or other large text files.
For example: 3rd line: '+3'; 3rd line from the end: '-3'


1. Output the last few lines of a file

tail file.txt

2. Output a specified number of lines from the end of a file

tail -n 20 file.txt

3. Track changes to the file

tail -f file.txt

4. Output the process ID of the last process that modified the file

tail --pid=1234 file.txt

5. Start output from a specified position

tail -s +10 file.txt

6. Sleep for a specified number of seconds between each output

tail --sleep-interval=5 file.txt

The following is an example using the -s parameter. This command will output starting from the 3rd line of the file.

tail -s +3 file.txt