NET 4000 Chapter 10.1.7: 10.1.7 Log File Display Facts
Document Summary
The following table describes commands to view and manage text-based log files: View the contents of a log file. cat /var/log/messages shows the entire text of the messages log. grep. Filter text from a text file. cat /var/log/messages | grep ftp filters the output of the cat command to show only lines that contain the term ftp. Show the last 10 lines of a file. F displays additions to the log in real time. N# specifies the number of lines to display. tail /var/log/messages shows the last 10 lines of the messages log. tail -f /var/log/messages displays the real-time entries of the messages log as they are updated. Show the first 10 lines of a file. head /var/log/messages shows the first 10 lines of the messages log. Scroll through individual pages of a file. less /var/log/messages allows scrolling through each page of the file.