tail command
Show the last lines of a file, or follow it as it grows.
- Text processing
- Package coreutils
- 6 options · 7 examples
Syntax
tail [options] [file…]Provided by the coreutils package. Run man tail for the full manual.
Common options
| Option | What it does |
|---|---|
-n N | Show the last N lines (default 10) |
-n +N | Start from line N |
-f | Follow: keep printing new lines |
-F | Follow by name; survives log rotation |
-c N | Show the last N bytes |
--pid=PID | Stop following when PID exits |
Examples
Last 10 lines
tail /var/log/syslogLast 50 lines
tail -n 50 app.logFollow a log live
tail -f /var/log/nginx/error.logFollow through log rotation
tail -F /var/log/app.logFollow and filter
tail -f access.log | grep 404Skip the header line of a CSV
tail -n +2 data.csvFollow several files
tail -f /var/log/nginx/*.log
No example matches. Check the options table or search the guides.
tail guides
- tail Command in Linux with Examples Linux Commands · Updated Apr 2025
