tail
Output the last part of files — default is the last 10 lines.
Synopsis
tail [OPTION]... [FILE]...
Examples
tail -f /var/log/syslog
tail -n 50 error.log
tail -f --pid=$$ output.log
tail -n +5 file.txt
Common options
| Flag | Description |
|---|---|
| -n | Print last N lines |
| -f | Follow file as it grows (live tail) |
| -c | Print last N bytes |
| -F | Follow by name, retry if file is replaced |
| --pid | Stop following after process PID dies |
About tail
The `tail` command output the last part of files — default is the last 10 lines. Text viewing and editing commands are fundamental tools in any Linux user's toolkit.
Linux treats almost everything as a file, so the ability to quickly inspect, filter, transform, and edit file contents from the command line is critical. These commands are regularly combined with pipes and redirects to build powerful data-processing pipelines.
The command accepts 5 commonly used flags shown above, though the full set of options is available in the man page (`man tail`). The 4 examples on this page cover typical real-world usage patterns that you can copy and adapt for your own workflows.
Related commands
More File Viewing & Editing Commands
Other commands in the File Viewing & Editing category