Back to DevOps Series
How to use Tail Command in detail :

How to use Tail Command in detail :

2. tail Command

Definition

tail displays the last few lines of a file.

Syntax

Loading...
Example
Loading...
Output (last 10 lines)
Loading...

Show last 5 lines

Loading...
Output
Loading...

Watch a file as it grows (very useful)

Loading...
  • f means follow.
If new lines are added to server.log, they appear automatically.
Example:
Terminal:
Loading...
Another process writes:
Loading...
You immediately see
Loading...
This is commonly used for:
  • Watching server logs
  • Debugging applications
  • Monitoring system logs
Press Ctrl + C to stop.