Skip to main content

Linux Tips: Using Less

Linux Performance
By Keith Edmunds11 May 2017No Comments

The less utility is a popular way of looking at text files, but it has many features that few are aware of. As well as scrolling forward and back, here’s a few options available while viewing a file:

Right or left arrow: scroll horizontally
g: go to top of file
G: go to end of file
/pattern: search forwards for pattern
?pattern: search backwards for pattern
n: repeat previous search
N: repeat previous search in reverse direction
F: Scroll to end of file and keep reading it (similar to tail -f)
=: show current position in file
-n: Hide line numbers
-N: Show line numbers
v: invokes the editor to edit the file

There’s lots more: maybe perusal of the less manpage over coffee would be helpful.

Could this Linux Tip be improved? Let us know in the comments below.