tail
What is tail?
tail: Tail — Show the last N lines of a file. -f follows new output in real time. tail shows the last lines of a file, ten by default. tail -n 50 app.log shows the last fifty lines, which is usually where the most recent errors are. tail -f keeps following the file and prints new lines as they are written. It is the classic way to watch a log while you reproduce a problem in the browser. tail -F also keeps working when the log file is rotated and replaced.
Frequently asked questions about tail
What should you keep in mind with tail?
Combine it with grep to filter, as in tail -f app.log | grep -i error. In Laravel, storage/logs/laravel.log is the usual file to follow. For containers, the equivalents are docker logs -f and kubectl logs -f, because container logs go to standard output rather than a file.
At a glance
| Category | CLI commands |
|---|---|
| Explained by | Reinier de la Parra |
| Updated |