Less Command

Linux Ubuntu

Flynn Weeks

Flynn Weeks

January 31, 2022

An example of how diverse the options in the Linux command line are for viewing logs, the less command can also be used to show a parsed output of the log file. Less allows for the file to be opened and searched from the command line in two different ways. When the command less /var/log/auth.log is entered, the auth.log file is opened and can be searched through by entering /”string” (such as /session opened) and the results will be highlighted. You can scroll or navigate through the results with N or n.

The auth.log can also be launched with the desired results highlighted directly from the command line by entering the command less -p “string” /var/log/auth.log (such as less -p “session opened” /var/log/auth.log) and this will open the file with the matching string highlighted.