Watching your logs in real time
Sometimes when setting up new services or when troubleshooting a problem, you want to watch your log files as they grow. You want to see each line that gets added to the log as it is added. You can easily do this using one simple Linux command, tail -f
The tail command displays the last 10 lines of a file by default. You can change it to display more or less. The -f option makes the command "follow" the file. This means as things are appended to the end of the file, they are displayed on your screen. To stop following the file, simply press Ctrl+C
For example, if our apache web server is displaying errors when you try to load a page, you could follow its error log and then intentionally trigger the error by visiting the page giving the error.
tail -f error_log
This will start by displaying the last 10 lines of the error_log and then as lines are added, they will be displayed as well.




commands

Comments
There are no comments yet.