forked from cheat/cheatsheets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
less
46 lines (33 loc) · 792 Bytes
/
less
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
44
45
46
# Go to end of file:
G
# Go to start of file:
g
# To edit the current file in $EDITOR:
v
# Search in file:
/<searchterm>
# 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.