Beginner Package: coreutils

tail

Show the last lines of a file, optionally following new additions.

Syntax

tail [options] file

Description

tail prints the end of a file, and with -f will keep the file open and print new lines as they are written — the standard way to watch a log file in real time.

Examples

tail file.txt
Show the last 10 lines
tail -f /var/log/syslog
Follow a log file live, showing new lines as they arrive
tail -n 100 file.txt
Show a specific number of lines from the end

Applies to

Ubuntu Debian Linux Mint RHEL CentOS / Rocky / AlmaLinux Fedora Arch Linux openSUSE Alpine Linux