Online Linux Terminal Logo
OnlineLinuxTerminal
Text ProcessingCLI Reference

$tail

Output the last part (bottom lines) of files or stream real-time logs.

Syntax DefinitionPOSIX standard
tail [OPTIONS] [FILE...]
Linux Community2.4k Online

Chat with real Linux users, learn new commands & get free cheat sheet PDFs.

Try `tail` Live in Interactive Sandbox

Zero-install client simulation with real-time feedback.

Open in Fullscreen Workspace↗
bash — terminal

Overview & How tail Works

`tail` displays the final lines of files (default: 10 lines). With the `-f` (follow) flag, `tail` remains open and continuously streams new log lines to your terminal in real-time as they are written by web servers, databases, and background services.

Common Flags & Command Options

Flag / OptionDescription
-n [NUM]Output the last NUM lines instead of the default 10.
-fFollow mode; continuously output appended data as the file grows.
-FFollow mode with retry; keeps tracking file even if rotated or recreated.

Practical Real-World Examples

Example #1Inspect last 10 lines of authentication logs
tail -n 10 /var/log/auth.log

Prints the most recent authentication attempts.

Sample Output:
Aug 28 12:15:00 sshd: Accepted publickey for user from 192.168.1.5

Frequently Asked Questions

How do you stop tail -f live streaming in terminal?

Press `Ctrl + C` to send the interrupt signal and return to the shell prompt.