tail [options] [files]
- c : Prints the last N bytes of file; With leading +, prints the characters from the N byte in the file.
- n : Prints last N lines; With leading + prints lines from the Nth line in the file.
- f : Prints the appended lines on the terminal as the file grows.
Tail Command Examples
# cat example.txt virtual storage oracle virtual instance mysql backup dedicated hosting server cloud servers
1. Display last 10 lines
# tail example.txt
2. Display last N lines
# tail -n2 example.txt dedicated hosting server cloud servers
3. Print lines from the Nth line
# tail -n+2 example.txt oracle virtual instance mysql backup dedicated hosting server cloud servers
4. Print the last n bytes
# tail -c8 example.txt servers
5. Print characters from the Nth byte
# tail -c+79 example.txt cloud servers
6. Print last lines from dynamically changing file
# tail -f logfile