Site icon Tech News in India, India Technology News

Way of using tail command for viewing real-time log entries in Linux 101.

Way of using tail command for viewing real-time log entries in Linux 101.
0
0

Log files are one of the most useful tools in the Linux admin arsenal. There are some diverse log files on this open-source platform. The question is how to get the most out of the viewing.

Among various ways, the best way in using log files to troubleshoot a system is using the log in real-time. When the logging system writes entries to the log file, it will be easy to see and detect the cause of the problem.

Another option is to open the log file and then you can either scroll down or search across specific strings. The real-time option is more preferable to this method.

A handy command called tail is also available to view a log file. Tail manpage notes that a tail will print down the last 10 lines of each file to its standard output. Simply we can say that, tail prints out its latest entries soon once they are written.

To use this command, firstly, one should open a terminal window or secure shell into their server. For example, if you want to follow the input to the syslog file and want to see the last 10 lines written in that file, you should provide the command: tail/var/log/syslog. It is not like real-time, but it’s easier to check than viewing the entire contents of the file.

For viewing syslog in real-time, a follow option should be added to the command, like tail –f/var/log/syslog. Then you will get the printout of the last 10 lines written to the file syslog, and it will keep updating as we give input.

When we use tail like this in real-time, we’ll be able to view errors as well as information written to the logfile. Ctrl+C keyboard combination can be used to close tail.

The tail command thus not only helps you in viewing the content of log file but also in viewing it as it is written real-time. Linux operating system will provide this troubleshooting tool very soon.

Exit mobile version