tail

Display the last part of files and follow updates in real time.

What it does

tail shows the last lines of a file, typically used for logs. It can also follow files as they grow, making it essential for monitoring live output.

Quick Start

# Last 10 lines
tail file.txt

# Last 20 lines
tail -n 20 file.txt

# Follow file updates
tail -f logfile

Examples

# Follow multiple logs
tail -f /var/log/syslog /var/log/auth.log

# Show last 100 lines
tail -n 100 app.log

# Follow with retry (for rotating logs)
tail -F app.log

# Combine with grep
tail -f app.log | grep ERROR

Notes