-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathless.txt
43 lines (38 loc) · 1.59 KB
/
less.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
h help
# Search
/ search forward
? search backward
# protip: search strings are some kind of regex; you can search for multiple separate things using |
n next match
N previous match
& filter (show only matching lines). multiple uses will stack filters, use &<enter> to reset. ! negates. not sure
what works in both regular search and filter
-I case-insensitive all things
-N, -n enable, disable line numbers
-M -m "ruler" with x/y z% lines shown
:n, :p next, previous file
Alt-u toggle hilighting (also ESC u)
-S toggle wrapping long lines
r / R repaint screen / discarding buffered input (useful for buggered up color text)
-r toggle interpreting escape sequences (colored & styled text), also works as CLI flag
# Navigate
pagedown / space page down
pageup / b page up
u half page up
g / p start of file
G / Esc > end of file
F go to end of file and wait for more input, like tail -f
# this is for CLI specifically:
-F quit if the output fits on one screen
-r interpret escape sequences (for colour, say)
-i searching is case-insensitive by default (except when the pattern contains uppercase)
-I searching is case-insensitive even when the pattern contains uppercase
# less can also list the files in (compressed) tar archives!
# for the contents of a compressed file you can
gunzip -c file.gz | less
# or
zcat file.gz | less
# orrrr
zless file.gz
# you can set some defaults in the LESS environment variable, like
$ export LESS='-I' # searches and patterns are case-insensitive by default