cheat:less
# Go to end of file:
G
# Go to start of file:
g
# To edit the current file in $EDITOR:
v
# Search in file:
/<searchterm>
# 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 <filename>
# 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 <filename>
# or if already in less:
-S
# To save the contents to a file:
# Method 1 - Only works when the input is a pipe
s <filename>
# 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 > <filename> and Enter.
tldr:less
# less
# Open a file for interactive reading, allowing scrolling and search.
# More information: <https://greenwoodsoftware.com/less/>.
# Open a file:
less source_file
# Page down / up:
<Space> (down), b (up)
# Go to end / start of file:
G (end), g (start)
# Forward search for a string (press `n`/`N` to go to next/previous match):
/something
# Backward search for a string (press `n`/`N` to go to next/previous match):
?something
# Follow the output of the currently opened file:
F
# Open the current file in an editor:
v
# Exit:
q
$
cheat.sh