less is part of the GNU project and is free software. It is a program similar to more, but which allows backward movement in the file as well as forward movement. Also, less does not have to read the entire input file before starting, so with large input files it starts up faster than text editors like vi. Less uses termcap (or terminfo on some systems), so it can run on a variety of terminals.
For opening file we just write less /path/to/file in terminal.
system1:~ # less /etc/inittab
/ – search for a pattern which will take you to the next occurrence. n – for next match in forward N – for previous match in backward
Once you have opened a file using less command, any content that is appended to the file after that will not be displayed automatically. However, you can press F less command will show the status ‘waiting for data‘. This is as similar to ‘tail -f’.
Go to end of file or beginning
G - go to end of file g - go to beginning of file
e ^E j ^N CR * Forward one line (or N lines). y ^Y k ^K ^P * Backward one line (or N lines). z * Forward one window (and set window to N). w * Backward one window (and set window to N). d ^D * Forward one half-window (and set half-window to N). u ^U * Backward one half-window (and set half-window to N).
:e [file] * Examine a new file. :n * Examine the (N-th) next file from the command line. :p * Examine the (N-th) previous file from the command line. :q * Exit program.