LESS Commands Cheat Sheet

Here is a cli commands cheat sheet for LESS command, you can use this as a quick reminder for basic commands with a brief description for each of the commands.

What is LESS command?

Add some data here

        # Go to end of file:
G

# Go to start of file:
g

# To edit the current file in $EDITOR:
v

# Search in file:
/

# Filter content:
&

# Next result:
n

# Previous result:
N

# Toggle search highlighting:
Alt-u

# Follow (tail -f) a file after opening it:
F
# To start less in follow-mode:
less +F 

# To disable the terminal refresh when exiting:
less -X

# Move to next file (if multiple files opened, eg. `less file1 file2`):
:n

# Move to previous file:
:p

# Don't wrap long lines:
less -S 
# or if already in less:
-S

# To save the contents to a file:
# Method 1 - Only works when the input is a pipe
s 

# Method 2 - This should work whether input is a pipe or an ordinary file:
Type g or < (g or less-than) | $ (pipe then dollar) then cat >  and Enter.
    

Check out the LESS command documentation .


You can also check our MegaSh cheatsheet tool, that has 150+ searchable linux cheat sheets in one page, so you never forget a command as you work again

Check Also

Best AI tools list